From patchwork Tue Feb 26 11:56:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10830007 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7566515AC for ; Tue, 26 Feb 2019 11:56:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C5572B5C3 for ; Tue, 26 Feb 2019 11:56:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F5A72B606; Tue, 26 Feb 2019 11:56:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EB6732B5C3 for ; Tue, 26 Feb 2019 11:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:In-Reply-To: References:Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hPkHOpfHjk/Tm+ZCDPHlDVgEFXSDHdtAo09jVBjBiJ8=; b=Npe52ujIXBcUR7 k0lUoiIuM017oex4lIV/dCoxhF6RUcnenj0kZPNju6dXfX1pvOJhjsun9HbrnQR2Z4KNB3pdOZOva 2Vz36lebpF6X8cpiI9m0q3vlNfpn/GaoXVvlRv24oPi7lzk7zj7BEgDIHmvxY1hw9e/IMK2Ddt+/w sPxKsdhCCInHmvaRL6rMwBunSwwnuiF8Dni/Z8zPv1o52HY/bll3ooYxIY5jwmTH2ahZt3+LYj0cX nre8Zph8CaNqObiI/iq1G22WQPpS3vllP3XmcG0oohaWtddLrrU1z/JTWVyStwT44vptljiBrIanb qqO0clgejx9Z/z4GP7Hg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gybLj-0002Hv-Hq; Tue, 26 Feb 2019 11:56:39 +0000 Received: from mail-eopbgr750040.outbound.protection.outlook.com ([40.107.75.40] helo=NAM02-BL2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gybLO-0001ze-FV for linux-arm-kernel@lists.infradead.org; Tue, 26 Feb 2019 11:56:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=M48mEhrYZsVYb+OMxFVes8aHZ7bPq2vlD5rD5ZjYUUQ=; b=sxlw/3p0FasnpSOlxxGYsHc8vSGTnXNjpsQ+9mdlN6fLbnM2oFodxigBhboCwDBHPGF1jW7MrCU0KwaQplvVo0RmuDl3wu8rOY51SMtTCKcbAHsaBF0Rqnf+KiT17nTgCE9JEMWNxrtXNDcCmX/lNATNsaAPDKmpcPV3yThNeB8= Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by BYAPR03MB4423.namprd03.prod.outlook.com (20.178.49.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.21; Tue, 26 Feb 2019 11:56:15 +0000 Received: from BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::1cca:e5f5:d31d:1e5c]) by BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::1cca:e5f5:d31d:1e5c%5]) with mapi id 15.20.1643.019; Tue, 26 Feb 2019 11:56:15 +0000 From: Jisheng Zhang To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH 1/5] PCI: dwc: fix dw_pcie_free_msi() if msi_irq is invalid Thread-Topic: [PATCH 1/5] PCI: dwc: fix dw_pcie_free_msi() if msi_irq is invalid Thread-Index: AQHUzcpGhI7fWXBN+EyRjGP8KV1eAw== Date: Tue, 26 Feb 2019 11:56:15 +0000 Message-ID: <20190226194909.0e0c4758@xhacker.debian> References: <20190226194806.34fc23b5@xhacker.debian> In-Reply-To: <20190226194806.34fc23b5@xhacker.debian> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [199.33.119.15] x-clientproxiedby: TYAPR01CA0101.jpnprd01.prod.outlook.com (2603:1096:404:2a::17) To BYAPR03MB4773.namprd03.prod.outlook.com (2603:10b6:a03:134::24) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: de77967d-e309-401f-cd2a-08d69be168f3 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:BYAPR03MB4423; x-ms-traffictypediagnostic: BYAPR03MB4423: x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; BYAPR03MB4423; 23:Eb0Rxyb7tnesu+P6rXlOCLbepki1T2I+SrXun5MOL?= uTC3LRUPMQPdyXI5fCzBr0JDvQkbW7+o731wmxcoLkRlrzJJpUBzblLsWZGittJEBIIICpHkEeNqFhCwsZEvPoCbKYMqa/+SSXzFCCNAC/Do/5aPXuDNOU9hBLCCREnLHNAZ/uaipS3n6Db416QbtMX59uEBEbvu7WmqOfWBs/og74iNzxOvISimNN1rD8gLiTer2SxJoCR0b6FGnLvEzgCvmVWEHd+QgG63+0X6HBuN7mLaELGAEefdVvFiU1cfqfYbrZvdSBX8OCBTXbOqWZLyuScBOIguf3lLYiWY1jvvxO9japbSpMGHHoo3/nsN9oyxNEI1kZo8TxKl9bR+5Kx5XDAl5TDeoxSx0ga3mkBA47FsmbmWCgT9F+VUiVEdUYSY21ywevX6nkOFfFZPbFHBVqNzVVEJdWcyygVZRv7QY/nmzLpgsoL/RXurLNBfkh68N/M7x5hI+XqLyFmK4P4GL063fpMBVc1Vvds4NfbUK/lkTOCLr7n2qDmRKsnBpXnYNLqK7WGYmy5cnfp0WvCfzDsKyV5mBcHW0mbocsy2r/7WPRogasjT1t8NgPjdJhEBvShJ87GXcLWFRY2+9LJesR8b2oDxVg6xaleimXpSmRHmoefpGkq+UXKPibPuy1nqJd6Y3bT8JPKxQyoorMjcz8T/dWrGW6KeCti8j8TflHFOXMGFqpg3shg0QyHay0kes0Op7JTaII+CyIfpUfgYd8riXELfIHbRNhsLISZqrX34qWZ5wWu01xsX83m9HIy1bOV/WG9z2gQxitpKTa8D3LSZFPmzA1H4zQzzW8Nyu9wHquUHjdunSFNmmFgADp11CwQf4nfyWdzUZl2OjTa9Zt1uboZQK3VH5adCALNcEcmpn2lTaJ5PCqrH/1r0sR2/1K6JhXje5YA7pxfi+oKuo/68OeNFswJOZ74MO1FrNBt82IWXjWx+Eeg5qZE1FnDyY8kDFccUrKHGvxpiMF495wFwOI37kohqgHP/16lEzXjq713xhsLo3YLXr2X7HcpIc7pQ4GXGIgGHoN31AZa+as3V8rLnPpzzOC7bvYz3Cg4noBRuOCOJXdTSUmdJor9gyTyyc0Hed+XsAvv0uIF3htA3sGlh7lunmJ+239pnMhrnJP42Kjo/F3EkVLLuHq1k9fiTmDZqHMuMbLswBWfHZ/SdiY2EFqmIuva2mdjGC7BzLUFqAlGH5+BhYpYZ94= x-microsoft-antispam-prvs: x-forefront-prvs: 096029FF66 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(39860400002)(366004)(396003)(199004)(189003)(81166006)(106356001)(50226002)(6506007)(81156014)(6116002)(386003)(102836004)(305945005)(26005)(7736002)(97736004)(99286004)(3846002)(8676002)(76176011)(52116002)(68736007)(478600001)(2906002)(8936002)(72206003)(105586002)(110136005)(25786009)(316002)(66066001)(9686003)(6436002)(86362001)(486006)(2201001)(6512007)(2501003)(5660300002)(476003)(53936002)(256004)(6486002)(14454004)(186003)(4744005)(1076003)(71200400001)(71190400001)(11346002)(446003)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB4423; H:BYAPR03MB4773.namprd03.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:0; MX:1; received-spf: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: g4206jVa/1oP3Eo8XBPkfW4pHPH2T2A2dPuq2UiCjK5wjBurZ0NEtmxvFKh6EjBF+T13ZA06ZDcAxuhykMw1cczFwpGjcV7Tubhs0Oo2oMjZq0ElJ+KqAmL7YTioVNOdwhBJ38zUjYnjMcnLQ6p2T6hbiskI9bYDf4msmqDZaQVfq2ZpohJzbd/96tOxBKcrmwR9BoPVz9+EbSL01LnUuNu/l5GKhhz34tSBz/XJwImMuLfNRy+YFTTMMJJRhuTAJLJdWYvY6t0Dpml+VIOuOxhHrl2M9yHuSNBHxftlKD1sttXFHuQTMbnVojeiaBXFd8NrsijLhKy5Xy5cSjkkxlsTAh6kIWL/vayAkWPs3BWK4tfkFZbTt4rqW+8rGw6G0bG7iN9gwHkB/r+fqDjMEeW8BP6QWsDiSG95fIh4qzQ= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: de77967d-e309-401f-cd2a-08d69be168f3 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Feb 2019 11:56:12.9684 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4423 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_035620_751606_0335897C X-CRM114-Status: UNSURE ( 9.99 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP we should check msi_irq before calling irq_set_chained_handler() and irq_set_handler_data(). Signed-off-by: Jisheng Zhang --- drivers/pci/controller/dwc/pcie-designware-host.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 0c18ab63811f..a94d3530b694 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -298,8 +298,10 @@ int dw_pcie_allocate_domains(struct pcie_port *pp) void dw_pcie_free_msi(struct pcie_port *pp) { - irq_set_chained_handler(pp->msi_irq, NULL); - irq_set_handler_data(pp->msi_irq, NULL); + if (pp->msi_irq) { + irq_set_chained_handler(pp->msi_irq, NULL); + irq_set_handler_data(pp->msi_irq, NULL); + } irq_domain_remove(pp->msi_domain); irq_domain_remove(pp->irq_domain); From patchwork Tue Feb 26 11:56:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10830011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 22E251669 for ; Tue, 26 Feb 2019 11:57:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DBC62B5C3 for ; Tue, 26 Feb 2019 11:57:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 018732B606; Tue, 26 Feb 2019 11:57:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 95B1B2B5C3 for ; Tue, 26 Feb 2019 11:57:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:In-Reply-To: References:Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oCbWs20lVQyGWVHDU7oeJAl2JVgJ/p+3KNxGK6PP/+c=; b=bljT7qIEBt0qqT eJDfx2G5bSYMAJ2VVvs3Ln9HuccamQ6QJ3uq86oA+sUQH7wUMuq5/qJuUewEnfjjWVUsv7W+K6znZ sTV/dI/1qM0yM+azkbiPp3WmmLOrgt+5xGpeaIkScYRdHXDaKbjVUBCQJjGTg6HbT5bTJliSt5SR0 9JVjgBcFdp1QUVXIIR9lGsqzHgL+ezY8A0waV393mJfcpnpQWc7/gcxjFjmrBT1aCVXR0MoVUPOtA C+xgDpauphbU7YqCVutqebBHGaGJOHkI/VT+Rz3xmQcMVGMOkEItpaCVMeRM13neuTSCQeP2BLnde dCYJHv17LpqHE25xO9rg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gybM4-0002Yy-1O; Tue, 26 Feb 2019 11:57:00 +0000 Received: from mail-bl2nam02on0604.outbound.protection.outlook.com ([2a01:111:f400:fe46::604] helo=NAM02-BL2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gybM0-0002X3-Bc for linux-arm-kernel@lists.infradead.org; Tue, 26 Feb 2019 11:56:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Ex6uyZdWem6jPJGDdDtu1KGRvPYljhIDe98tVWT8nUs=; b=XxrENTlpe/5QYKfuq9SUOnD2AAYf2XOZWGIYLFJvQNu3fkZ4FyRqVutF0mVj1QOw2z5kS1eL3xua4uIPiPTEfk+iRrA++oQBnGUOQK6EyEdlFy3yJ1redOO/caShrULqFsJ5qpYuCVssZ4rVMS8AOslGpPSZD6oU24bxbDO3wW0= Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by BYAPR03MB4423.namprd03.prod.outlook.com (20.178.49.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.21; Tue, 26 Feb 2019 11:56:52 +0000 Received: from BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::1cca:e5f5:d31d:1e5c]) by BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::1cca:e5f5:d31d:1e5c%5]) with mapi id 15.20.1643.019; Tue, 26 Feb 2019 11:56:52 +0000 From: Jisheng Zhang To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH 2/5] PCI: dwc: free the page for MSI irq in dw_pcie_free_msi() Thread-Topic: [PATCH 2/5] PCI: dwc: free the page for MSI irq in dw_pcie_free_msi() Thread-Index: AQHUzcpcnRavJqeZhE+qMQkNx0b7CA== Date: Tue, 26 Feb 2019 11:56:52 +0000 Message-ID: <20190226194954.4ad0be3d@xhacker.debian> References: <20190226194806.34fc23b5@xhacker.debian> In-Reply-To: <20190226194806.34fc23b5@xhacker.debian> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [199.33.119.15] x-clientproxiedby: TY2PR06CA0018.apcprd06.prod.outlook.com (2603:1096:404:42::30) To BYAPR03MB4773.namprd03.prod.outlook.com (2603:10b6:a03:134::24) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bc539e5e-5cd2-4edc-1015-08d69be17ed8 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:BYAPR03MB4423; x-ms-traffictypediagnostic: BYAPR03MB4423: x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; BYAPR03MB4423; 23:ZcDw+LphJvcqWtGyWJXRnVlrsMzFLHaWaFXmPLRmZ?= +M2EXpu53LIX9ZOOQAn9u/LX/b3trLthQqezhLbyncisq1SoQqvJmbERxUSJweTanSHklCjsw+sWcfzck+1UKri5KeZel0uoqgNq7xn1scPSeKU9iHiRbwUWomvrr+04crZGMvs00FnmhRyY0HDdkS0nqRGL9XMcVA2TAEYXsDfzIBXSSy/axbB/d4mC0CvZyEOgcU/BPlVAv9TOSNdUz5qKZSrvgWFnype2uCDwZQvKCanUnjFhgQmTa4jEX5bINO3HWvH2ugUz0JKo2G27avPtSk0W83gNV3pQvppAhEjg8/NGJtTyL1c+T+e+0a0OhOVk4f5rxSggcbZH0ifkx3J2X/pWtoMI5nsNbNSmD4QhAVoLUW+L/+ZBjDKK3cdaHFSsV0Cr/aejTkGg87e6dex7tZM/TgzRG6Bw5gZEAhZAkHDkwBLHFysCqbfOPzXl+LuHTmsr2OZrAK/ogQ1QHBO5D5YO1/pkchgybpClpeL5L3SOgYfA1j9Yo8/3pAHj7HZMjCXUjke3S1VwwySG7AcewaRQ1SK8PyLeKAQf7ImzhWHo6rHpyT3H3sgj9kn18JRUZrUetcVCSJ1/Cbn3kb7a/R8zshM5XEmDOx30NfamA2qbz1/wt3LL94IV83OoJG+sglHN0jLNiMjvm5ZdULgJ8IqIPJn4+NLn6mpKeQmPMEXDdW3AgDi8VpErPula8oVFQEbeBBYfe4UR48OlXd6oX65JZIjPf/QreOwLZVCxecJUy33HGlas513NkFDFgZDvcjAGOMvPV9v9/kg/YKmKVqH5xVy7drhAHfHF8UjGz6K+Fu25FcOCUErfcR909Z9uGGMRuR0ueFILhapCbeHPaemfkhdpFFrfzDNFXLavsyvJgygn2+ubOBifNivCPOemim6WEI1IbWwOW82TybH2oIN9lWEKGfA2uoj89ekpwqkPaEHJYZ/omuqxrRiPdtquKfy/HrR0GSBH197R7ciu3J0KX7TxH98jv71V1rMVjH8Vr1treie4P/euYRPrzYPYSpEdDoXKqzvYFXykRWAuDlH+PDUwvII7pSjyhHJEsVpKBn3lYgLzYVItL/M3zrzzrX38pNp76jGjIktLM+ponv/FPI8zdJc/lazPRSG5mHb9RAnCKgZ1MUr2QwJH5qXPCmBxpnE+H2JfeCA6NtQ18t5yL9+Ru1M1g8JotPcag== x-microsoft-antispam-prvs: x-forefront-prvs: 096029FF66 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(39860400002)(366004)(396003)(199004)(189003)(81166006)(106356001)(50226002)(6506007)(81156014)(6116002)(386003)(102836004)(305945005)(26005)(7736002)(97736004)(99286004)(3846002)(8676002)(76176011)(52116002)(68736007)(478600001)(2906002)(8936002)(72206003)(105586002)(110136005)(25786009)(316002)(66066001)(9686003)(6436002)(86362001)(486006)(2201001)(6512007)(2501003)(5660300002)(476003)(53936002)(256004)(6486002)(14454004)(186003)(1076003)(71200400001)(71190400001)(11346002)(446003)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB4423; H:BYAPR03MB4773.namprd03.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:0; MX:1; received-spf: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: kaektce/DGv2ccOKpZzQV+nK1oeVWd9EbhYEyZUdxOBOH8GamI2fITtNXoUp0M9a8zZOOe59X23pZWyeFeIjcrpGsKhDYppKS4klCPZEPq2FKYTuoi34AOovxZw21VR5/pWbkCXusItYaDt6iEWBcgvOqkYf2wKob7o91DzG9zuhPHtMpkrl2ap3V2YZtPOSGQJYZkrjJTICvV8TYXirNfKmvW3tYS0fzXN1fbw/rzadH4UGMumvNAZQJNy4PhQCFnKq8qtHeqbvXR9VGgu/jHlv4kyYOTliE0VRqHeVMPwXTDjUk+5l187QND/x3doJOh24H4nvOZZ/UK0eenAk80UgLoIHklUbt47u6N3p/AOBgHrdyjKnVMjbSu+7iJAGyOofiGIdLlkGOrXqjq35XgWu2lUrR2aq4J7HneBAnD0= Content-ID: <3B91CE88369CA0449E23D88A7011297F@namprd03.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: bc539e5e-5cd2-4edc-1015-08d69be17ed8 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Feb 2019 11:56:49.7035 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4423 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_035656_493462_656FFE5B X-CRM114-Status: UNSURE ( 9.65 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP To avoid memory leak, we need to free the page for MSI in dw_pcie_free_msi(). Signed-off-by: Jisheng Zhang --- drivers/pci/controller/dwc/pcie-designware-host.c | 3 +++ drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index a94d3530b694..abe3ff5f0867 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -305,6 +305,8 @@ void dw_pcie_free_msi(struct pcie_port *pp) irq_domain_remove(pp->msi_domain); irq_domain_remove(pp->irq_domain); + + __free_page(pp->msi_page); } void dw_pcie_msi_init(struct pcie_port *pp) @@ -322,6 +324,7 @@ void dw_pcie_msi_init(struct pcie_port *pp) return; } msi_target = (u64)pp->msi_data; + pp->msi_page = page; /* Program the msi_data */ dw_pcie_wr_own_conf(pp, PCIE_MSI_ADDR_LO, 4, diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index f6fb65a40f10..3be7ca9f1fc3 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -179,6 +179,7 @@ struct pcie_port { struct irq_domain *irq_domain; struct irq_domain *msi_domain; dma_addr_t msi_data; + struct page *msi_page; u32 num_vectors; u32 irq_mask[MAX_MSI_CTRLS]; raw_spinlock_t lock; From patchwork Tue Feb 26 11:57:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10830019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1D53F17E9 for ; Tue, 26 Feb 2019 11:57:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04EB32B5B1 for ; Tue, 26 Feb 2019 11:57:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED4BB2B5C3; Tue, 26 Feb 2019 11:57:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 87D312B5E6 for ; Tue, 26 Feb 2019 11:57:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:In-Reply-To: References:Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VDb00Xryi76zhKASEjRbjb2bPlC5XnmyYmrapBo8SSk=; b=b+KDoJUK8fP5HZ Tijcad5HhxVXPT2XQvVZfcW5ixbzvW5l4iv6N+yHnJ97Z2QnBpO1hi81q93tDz7J47J+RZyD6/1nf hYPvGvtyED3OIPoghLuTUssVMYhN951evDopQryJBAEvAvm+v1kNeJ36UG5RtqoyMtkCyhSKVyecN qk6DeESFqXOAr0N+sGBErH9kz3VpB5A6taLlyvmJnX5dxY4fF48o5LyB0zxUsKjrrQfsGxJw8pXNj n4XgS5Xp4USiPp6Y2ATTkcpedIosySE/JUV9tMiIiIGjKG5QO/gnpPoPWU9IFvQ6BAj4fW6lAe2FU gd5Si/ahIdVXweDHEf6Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gybMs-00036K-QW; Tue, 26 Feb 2019 11:57:50 +0000 Received: from mail-eopbgr750059.outbound.protection.outlook.com ([40.107.75.59] helo=NAM02-BL2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gybMq-00035d-2Q for linux-arm-kernel@lists.infradead.org; Tue, 26 Feb 2019 11:57:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CJrOO+e+wRNyb6fWknZF9YnjlA9kz18HJH8vJFqfQVI=; b=VqAKyExiMBdAXVl6fpTcd11YeEnOVizY6KY5SiJIF+uG5QheEm5zgBJ7q2TkCk06m9e4YgOxZpJ3Q5y4toPJeZ71QiYNBE4Fryjn2lKheSwut0szKWYyGnDLF1+7M6o79QmL7s6yQ+LDdjxCczYYRgIzKMn2N0vOWu6ZGatCsPw= Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by BYAPR03MB4423.namprd03.prod.outlook.com (20.178.49.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.21; Tue, 26 Feb 2019 11:57:45 +0000 Received: from BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::1cca:e5f5:d31d:1e5c]) by BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::1cca:e5f5:d31d:1e5c%5]) with mapi id 15.20.1643.019; Tue, 26 Feb 2019 11:57:45 +0000 From: Jisheng Zhang To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH 3/5] PCI: dwc: free msi in the error code path of dw_pcie_host_init() Thread-Topic: [PATCH 3/5] PCI: dwc: free msi in the error code path of dw_pcie_host_init() Thread-Index: AQHUzcp83KiWlVgU90+UWqSw15+DcA== Date: Tue, 26 Feb 2019 11:57:45 +0000 Message-ID: <20190226195047.26eab4c0@xhacker.debian> References: <20190226194806.34fc23b5@xhacker.debian> In-Reply-To: <20190226194806.34fc23b5@xhacker.debian> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [199.33.119.15] x-clientproxiedby: TYAPR01CA0172.jpnprd01.prod.outlook.com (2603:1096:404:ba::16) To BYAPR03MB4773.namprd03.prod.outlook.com (2603:10b6:a03:134::24) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 883016ce-b27d-4db5-ed40-08d69be19e8e x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:BYAPR03MB4423; x-ms-traffictypediagnostic: BYAPR03MB4423: x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; BYAPR03MB4423; 23:hyslu3gfMVbXDVksG5nDfjdpiTiebCREWxm4jn9wH?= 81nsEmBidNAjCzOMuJmnbMCSMp5xI967bMhJOa3qYlLRylljJaasXnRrQqCO4NJCcAhmvyO8gFrA1boj4cRnq++/H5FdmpHdBAf6T7NN1yAtPyeqFlQWq6WguOrJW4/juL+0MDb0czSUOU6+amo9ZfmekHUMhvbfMNoUfgyWOwvvw37r3e9cpRRmu7ykytheJGtIaLdWi2rZ1uL86dje8O0X8wDI2ZDH/aeHDZLCcG/KPYTBoY5Ld66605rmUHyedPDCIGYZS2oMSjNrivpI5j7pUzX8nB/Qcok7oBhtLWb9FF/fPv7M/20gNWJnOjcu4PEw8wDUJ5uEBwlnqT64+SLxZuKdarUx9ofLfmbFRqnbqNYZT8r1ZbNuZQlPi90VSPMnUPHG8ZcADmUeuDZvgKXYb93IG3XTNJKUWSY3iw4+o6PIacGy3Qz/GABxwGKT/7FU9Za+RqUj4c93yWazP6V6yeNFdoHNyjCLnoZewwkrxwgV1SGj1AGgAsktLxpYPtN8yibVFBHkhDAWsXo1nwvYaKef1ec9qaOI3Q2Y8FUvjmwLQa0Re1tuSiwSxXywrRE4KOa7sEK539T4H7uH6UpYhMCIIS7Fk6s1RTj6gvj3kkQhZCz5BisPFD+Cr52rNHm1YFojoyBC7MYtzP8QWMfZSzBzBETWpUPwY5BZ0oSfzHDkXcUQh0wHaagLxr45HBkzKy4xVePh2y7PrP8dRAyGibumL1i1KlM6RuvI3OpvVOJinE0oTukWqNGH0Vq8EoZVX5/wloCVGokS5cT3gkSMFf7v1q0DwQGehwboDoC13zHcAnXolHBVi8juBjluG3r3WAAw+eFcby2RYOuAOizSVPII0q0zR+XFIiuvnruDoik4uE9qcT6dI/zBTapdf22bhOjypn3fqPF6SeNzBBLOKGUqWmyPDd+i61LhIZ3cyQvoBj1GNAyETHKh2N6L9kud/bZJueyYpHXWV36dD+EplHfm7LH6S61tIyd+hAb7wFY3rH28JvVA2vPYXImNcEprXf70HReX8/f+eZZJOEmb1XMSX3PWs8yASz8dmemNTRZ7dB6yjx/QU/nhNBzhvKsh3Ea3p4nUxyFUgBpAQ99WcFllF6iHV6h5L1yF/w+aoBEd6SqYNJb0yRTQ8Uzli+xN0B94ciqtLzZkZSmpqM7/BbtSkhKlksPj5uCHrUw9g== x-microsoft-antispam-prvs: x-forefront-prvs: 096029FF66 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(346002)(376002)(136003)(39860400002)(366004)(396003)(199004)(189003)(81166006)(106356001)(50226002)(6506007)(81156014)(6116002)(386003)(102836004)(305945005)(26005)(7736002)(97736004)(99286004)(3846002)(8676002)(76176011)(52116002)(68736007)(478600001)(2906002)(8936002)(72206003)(105586002)(110136005)(25786009)(316002)(66066001)(9686003)(6436002)(86362001)(486006)(2201001)(6512007)(2501003)(5660300002)(476003)(53936002)(256004)(6486002)(14454004)(186003)(1076003)(71200400001)(71190400001)(11346002)(446003)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB4423; H:BYAPR03MB4773.namprd03.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:0; MX:1; received-spf: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: +DTF6V5Zpo4HQIE4kUYRoB38U/1bANvh3BF1OsFV9zH0BnkZR+Cn/VA6eSYqouTDrwNjfGNdLis79X80hgv6YOrPvgGEbUxywsXe9eH59NTzP5JJTJvyZxlNctYdbfH02+1VSGoWXXZXTqX2bb6h7DYLH67az6KpYFNJzKKPPwoiFUCwQBMFCVDo04+a9k+W3xqCZkx7By7YaosMojqO5/wfKW8hhndt/ZTrcj1ymKVXHfTEXaRa1a0DNhwKzxZb+A/zJ5AgD/cz7Bm5lk7KWhmAp0hNqeJlY9jCshWzwYrUQlOBQd6JazIJw38TVX58/25G+lf4o5kCoTJLGjuDnksAxm+YF9/lDb0tX0NQT1kmaOyXi3lAOMMA7q40kdcltUgdWFbEdhntNXaZgDKEnvA6UKO8tPup7yTdXtYazD8= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 883016ce-b27d-4db5-ed40-08d69be19e8e X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Feb 2019 11:57:42.9623 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4423 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_035748_109975_894799B1 X-CRM114-Status: GOOD ( 11.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP If we ever did some msi related initializations, we need to call dw_pcie_free_msi() in the error code path. Signed-off-by: Jisheng Zhang --- drivers/pci/controller/dwc/pcie-designware-host.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index abe3ff5f0867..66569d0f3ab9 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -482,7 +482,7 @@ int dw_pcie_host_init(struct pcie_port *pp) if (pp->ops->host_init) { ret = pp->ops->host_init(pp); if (ret) - goto error; + goto err_free_msi; } pp->root_bus_nr = pp->busn->start; @@ -496,7 +496,7 @@ int dw_pcie_host_init(struct pcie_port *pp) ret = pci_scan_root_bus_bridge(bridge); if (ret) - goto error; + goto err_free_msi; bus = bridge->bus; @@ -512,6 +512,9 @@ int dw_pcie_host_init(struct pcie_port *pp) pci_bus_add_devices(bus); return 0; +err_free_msi: + if (IS_ENABLED(CONFIG_PCI_MSI) && !pp->ops->msi_host_init) + dw_pcie_free_msi(pp); error: pci_free_host_bridge(bridge); return ret; From patchwork Tue Feb 26 11:58:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10830027 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8E31515AC for ; Tue, 26 Feb 2019 11:58:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 768152B08D for ; Tue, 26 Feb 2019 11:58:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 697EF2B606; Tue, 26 Feb 2019 11:58:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 095AD2B08D for ; Tue, 26 Feb 2019 11:58:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:In-Reply-To: References:Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hchVaLN55yfml9sJYohZGVIBoHS9FYCIu5f8HzV2y3Y=; b=kcGI8qDOFlHfhy ZsgEivGEWhlSqPb7AsPZDtoWj6rzuU7ESUHIsnCaH5ruQp3Z49Ld3qwtUgyXDECYHuAGknLC2exze QOIgVPy1Ph5zXa2tNCyDSsjuPRPHNj0RcvLX35RVKbCf34fBMMb9NbIqaDfyTjURJDsHHDqG6g0HR mfc+PzsXxcBKryOa+KsgVZ0Ef7MlTNXf1YaYlH9caOxv9gt4Y8OQsTjs2HBQzMZmm8Q2mkPu73sRk jN5W/GI66vFNfNW8MYx+PFBlHGUv67HSb4gG6hYmiMr5WKLJEbo/wWDNxXq2/f9NE+XtEhzjDf8Rw tOMn2WeqzeAnBNakNGlQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gybNY-0003OE-Ov; Tue, 26 Feb 2019 11:58:32 +0000 Received: from mail-eopbgr710073.outbound.protection.outlook.com ([40.107.71.73] helo=NAM05-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gybNV-0003Ng-4Q for linux-arm-kernel@lists.infradead.org; Tue, 26 Feb 2019 11:58:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kCIAgyc0dyZXGWnEL+YP+rbIulW9e2ZVM0504mRNcjk=; b=jwo5PdbcESNEStlwO4OnsaqD8HkF5xP9VzLBYtSQkfrcHKow0fomIT/HUdYpC2rB37H8iLd3ph/VL9aTU88aGjkhB4PiaoRreLHYGr5MDGmLENkjkMxN4NR6U3ZOMSa0zwwcDg1JP3ANliyHzw2f2tprEu+NLGi7P3pA59yX2ac= Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by BYAPR03MB3989.namprd03.prod.outlook.com (20.177.126.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.14; Tue, 26 Feb 2019 11:58:26 +0000 Received: from BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::1cca:e5f5:d31d:1e5c]) by BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::1cca:e5f5:d31d:1e5c%5]) with mapi id 15.20.1643.019; Tue, 26 Feb 2019 11:58:26 +0000 From: Jisheng Zhang To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH 4/5] PCI: dwc: use devm_pci_alloc_host_bridge() to simplify the code Thread-Topic: [PATCH 4/5] PCI: dwc: use devm_pci_alloc_host_bridge() to simplify the code Thread-Index: AQHUzcqUjIgD4+38S0qkh/9pYJbfpg== Date: Tue, 26 Feb 2019 11:58:26 +0000 Message-ID: <20190226195127.72dd45e0@xhacker.debian> References: <20190226194806.34fc23b5@xhacker.debian> In-Reply-To: <20190226194806.34fc23b5@xhacker.debian> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [199.33.119.15] x-clientproxiedby: TY2PR02CA0024.apcprd02.prod.outlook.com (2603:1096:404:56::36) To BYAPR03MB4773.namprd03.prod.outlook.com (2603:10b6:a03:134::24) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6d1780f7-b5fe-43e5-5e9a-08d69be1b730 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:BYAPR03MB3989; x-ms-traffictypediagnostic: BYAPR03MB3989: x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; BYAPR03MB3989; 23:Ql5tN9+MGTHqOPqyzLsb92BXHVjKS/tfVWbOTu/eA?= Q1vvdjGqyfPzLWxQZc7I8dGxpT73FmoWDzT1EPNNcILJkn7dYpXcPX+FSBzld7HdFrLg7OwD9lSrDSZwPfZP7kYDHvq6Ogf46ATNwZtVHjIFNs++Lh+qkW77GMfQlcG8EYeJeaXEbCtCOfEtdr+XHfQ3XNoF+AYsQ1YhudH/sNrAakp/j0HY8Zl8EGA06SqktQG7Ov+MjyQiX2RfA76/y5UUwBH55cP19mdOIqX6U7lw5o727oOS9TamFagqmfteHwrwikilH4LjBdb+uAb4ozv9j6TJjylN6x0LHZ3UgpBXDBBmWsKWRpvfaaSoqC92SOglppmjPXdb+/tHYkQw7FrisYJbPbk0F9SCQMHqoOL6izJ6+jgo+v0SraN2Lv9kw11FHprJU/DR9GbXdSxYph8E0IYkXfnv43vhOhknRPVz+0KYi91RFAXuWV4ulC4plv4qBWb2J0A4ItcvcTCXcIOgRHyFWHVdAmuCJ3ZotmiljNP61iEAPPXci4c8AwX8g1kbfdwWr1L6RHCbsHEmqrnbKvUlYDe3bd9W1zI38ajaGzyjrEJFlit1/oNAPe068Nj5FQQv4O9CH8ACxVXmLuTH1l4jEsme1KAPgdxzRmClA2fFFOi4PIj0Hc+AOnv2h6O+e9v+GBhWAshw4yvHSYAire0xDy5Ts23hnqogOjaft38/P99lice7XLmfQaWo2WWF8Kg1TYdkEWZP/vSUKx2yG64naLtOvMWQjfzsYNO7pvByh1OPS83FHycK4VFmgMCBxRE5Us0AzoR5nTbgx595kAfUrzoVONHjpnp0x0Ke9mPNhsKYcIZJ0WJQglcuKluQ2y1+nXr8McZ1W+Fbe67cqFR6VtLRFhSqOKI3xLiL0WDfg3/eecv3AqfNeHZbCjkFnij5sdpQ837RMH2bpKQ2+XsQKA+TcmpADkQtrbNHnExrqDrhzBbL5zLNJoBeOkeRFDa5SYALcNu7Yni7i2FrwJ40xDssTctuqWb2kixORyODh0CxsLLNcCYJt4ot0qnCMrORJj6WRFVA8jdkOaxwk77igI0/FLUy9F9EqIZrn00ZO/pma7j0Bay7IXetOssG+4zjHYJ0NDHMftMVJ+15fNjwyftBgv5KWDoWiBE2mhM9m1zaJNDhIu45ZteM29oWNynuaAXW/gwAhFEOFHnwypZgVXBAH9OhYPxVWJWqoZNRar2ubdA3D/vJqrDu8w= x-microsoft-antispam-prvs: x-forefront-prvs: 096029FF66 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(346002)(376002)(366004)(396003)(39860400002)(199004)(189003)(1076003)(72206003)(26005)(6436002)(6486002)(316002)(2501003)(52116002)(6116002)(3846002)(486006)(25786009)(102836004)(76176011)(186003)(476003)(2906002)(11346002)(5660300002)(105586002)(446003)(256004)(14444005)(106356001)(6512007)(9686003)(68736007)(71200400001)(71190400001)(7736002)(305945005)(86362001)(8936002)(2201001)(478600001)(81156014)(81166006)(50226002)(8676002)(99286004)(6506007)(66066001)(110136005)(386003)(53936002)(14454004)(97736004)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB3989; H:BYAPR03MB4773.namprd03.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:0; MX:1; received-spf: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: CDF2Eb3t5XEfjMfBj38gDfJwblxdU6dA3ZynGw+181JZ/92Y1+lAGJULyrN2IrceuYfAeRdVr0aabkdsTWk9KezZF3susuMA8AqU5fKkxNdJ6Ik/+FRT+jJalTzvPRaHwC6AYYoRPoU4G9Pc5N5DbthEePR6SG+uLjRp0fdi8vffIZZNcEau8Tx47tIuTSQoZh2FpzB5R2ro0L8hL+VE6xOMK3+v53RR98w7Iw/nnGxVUY9rlmtirTixhRXE4xe/kJ5OlPoaF9NeghgwGpirShl5nS0k1Q0pZhOcOUxR3TIbb1QDscyqN8QAUNnwnOY7Kj34nAbntM5d6qaT9SwBYrcw1WOw0yvuzFaX2qiiH/K/do96LJcWJheG1MmCc7tVU4oVShyV4MZENAQtnTyl6vIa1qhrpJbBAOwarpzXHqo= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d1780f7-b5fe-43e5-5e9a-08d69be1b730 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Feb 2019 11:58:23.8473 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB3989 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_035829_178373_90C6370F X-CRM114-Status: GOOD ( 12.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use devm_pci_alloc_host_bridge() to simplify the error code path. Signed-off-by: Jisheng Zhang --- .../pci/controller/dwc/pcie-designware-host.c | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 66569d0f3ab9..4831c12fee93 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -357,7 +357,7 @@ int dw_pcie_host_init(struct pcie_port *pp) dev_err(dev, "Missing *config* reg space\n"); } - bridge = pci_alloc_host_bridge(0); + bridge = devm_pci_alloc_host_bridge(dev, 0); if (!bridge) return -ENOMEM; @@ -368,7 +368,7 @@ int dw_pcie_host_init(struct pcie_port *pp) ret = devm_request_pci_bus_resources(dev, &bridge->windows); if (ret) - goto error; + return ret; /* Get the I/O and memory ranges from DT */ resource_list_for_each_entry_safe(win, tmp, &bridge->windows) { @@ -412,8 +412,7 @@ int dw_pcie_host_init(struct pcie_port *pp) resource_size(pp->cfg)); if (!pci->dbi_base) { dev_err(dev, "Error with ioremap\n"); - ret = -ENOMEM; - goto error; + return -ENOMEM; } } @@ -424,8 +423,7 @@ int dw_pcie_host_init(struct pcie_port *pp) pp->cfg0_base, pp->cfg0_size); if (!pp->va_cfg0_base) { dev_err(dev, "Error with ioremap in function\n"); - ret = -ENOMEM; - goto error; + return -ENOMEM; } } @@ -435,8 +433,7 @@ int dw_pcie_host_init(struct pcie_port *pp) pp->cfg1_size); if (!pp->va_cfg1_base) { dev_err(dev, "Error with ioremap\n"); - ret = -ENOMEM; - goto error; + return -ENOMEM; } } @@ -459,14 +456,14 @@ int dw_pcie_host_init(struct pcie_port *pp) pp->num_vectors == 0) { dev_err(dev, "Invalid number of vectors\n"); - goto error; + return -EINVAL; } } if (!pp->ops->msi_host_init) { ret = dw_pcie_allocate_domains(pp); if (ret) - goto error; + return ret; if (pp->msi_irq) irq_set_chained_handler_and_data(pp->msi_irq, @@ -475,7 +472,7 @@ int dw_pcie_host_init(struct pcie_port *pp) } else { ret = pp->ops->msi_host_init(pp); if (ret < 0) - goto error; + return ret; } } @@ -515,8 +512,6 @@ int dw_pcie_host_init(struct pcie_port *pp) err_free_msi: if (IS_ENABLED(CONFIG_PCI_MSI) && !pp->ops->msi_host_init) dw_pcie_free_msi(pp); -error: - pci_free_host_bridge(bridge); return ret; } From patchwork Tue Feb 26 11:59:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10830031 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B21AB15AC for ; Tue, 26 Feb 2019 11:59:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BD2E2B07E for ; Tue, 26 Feb 2019 11:59:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C31A2B08F; Tue, 26 Feb 2019 11:59:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 37DF82B07E for ; Tue, 26 Feb 2019 11:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-ID:In-Reply-To: References:Message-ID:Date:Subject:To:From:Reply-To:Cc:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aHXf9yFRTJK1snwd/j3WDOp6JHuv6qVefUrw4HC88nQ=; b=cAWxZovWZE58X4 OLDX0kgvVRn/wiZSS0qH8QDkRUzWc9gLzO0fbx2s7JMvoCF83beFfMsoCdz6qsVpG7qGJwJpzSw/L sltR4zXvdqkXI4ZDj6nW7p/YxJFQqueC/gOplj/H5h8+m8/Uezn+RLVYoNcJ1Ou8GDTXPr5iJjM9R VWCPwT9+sqzAK9rChDPqd8WEu2MwngXkTqCBfRHzBuPZTA5JA34FVxGjfTHpTTZcpS5oYiUl4PMah 8Yv5Ov7AkxNd770GYHfEyyKztE6Ek9NbZPXN9fcIvzpg93ezQFUtA3MFcHf9GzWusLuSpm7jMFnkN qUFSdnFGANaj6eIcWmvQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gybOM-0003g4-PX; Tue, 26 Feb 2019 11:59:22 +0000 Received: from mail-eopbgr810059.outbound.protection.outlook.com ([40.107.81.59] helo=NAM01-BY2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gybOJ-0003fW-BT for linux-arm-kernel@lists.infradead.org; Tue, 26 Feb 2019 11:59:20 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HDfJa/5peeKUsjb5cZhVZj4vd75dEAlF9WieijY3ECo=; b=xQ4qJYt4HQeiGd7lOeC6um69IPp2lrAx/l3bGYFGzZ+tKe6D7x2iP4nKUFG8sTjWV2VFxh1MzlLTzD/lv9qWGf0i+iMyYrQkmDsfLF4DU6f+3MjodGo5rscxM0nrHElMiwkEgub+s8UA8WuQPKv/7zi9Sua1kp/+C83cXgReeAs= Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by BYAPR03MB3989.namprd03.prod.outlook.com (20.177.126.210) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.14; Tue, 26 Feb 2019 11:59:17 +0000 Received: from BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::1cca:e5f5:d31d:1e5c]) by BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::1cca:e5f5:d31d:1e5c%5]) with mapi id 15.20.1643.019; Tue, 26 Feb 2019 11:59:17 +0000 From: Jisheng Zhang To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH 5/5] PCI: dwc: save root bus for driver remove Thread-Topic: [PATCH 5/5] PCI: dwc: save root bus for driver remove Thread-Index: AQHUzcqyCHKOtYOyCkSTO+UrI8JSHA== Date: Tue, 26 Feb 2019 11:59:16 +0000 Message-ID: <20190226195211.7ac4926e@xhacker.debian> References: <20190226194806.34fc23b5@xhacker.debian> In-Reply-To: <20190226194806.34fc23b5@xhacker.debian> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [199.33.119.15] x-clientproxiedby: TYAPR01CA0045.jpnprd01.prod.outlook.com (2603:1096:404:28::33) To BYAPR03MB4773.namprd03.prod.outlook.com (2603:10b6:a03:134::24) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ce042779-c1fc-4253-cb62-08d69be1d522 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:BYAPR03MB3989; x-ms-traffictypediagnostic: BYAPR03MB3989: x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; BYAPR03MB3989; 23:oTiW0FNun+NO3PDOujGHNTeElKmtUGXwXmHSN7HLw?= GJWXEKOyCihK62q10JL7D+5R6TM11oUk3p2ucRWa2lvMcX7e+b54JAEWS2rjx4mgBy2vXgYrRLZiE50FzYvoo1wsccZ/UGlMG01Fk3c6pLq8gR6pAQklT1Nb26AOaiSTXSU3mwekJu3IHFjNWviAVeo8VWxr6/EKi+Bqnq6B0v7ZIaLJoP0D8GohvhOY4L49hKRP+smjvVxe1GiSL40p4XfGWaT4xZG22hU8tG+7maWdMw2L6qUed9Cg6JAK3l6u9XiDFk65F5dVnjbdPZ53TZ0lEljzUDulPDHdfQgHLOioFqcglHt+5ruuoCRo7Zdlgn7fj+6SHT4t7aWWQqtXkLdkg5kT0jnrda8t+YuNqQ67NKXyp/vdUYY52Rik8UtZlRJ4XH4UYPu2aL5/xoIq/GOZU2KVZ5bZ0TjTesHj5oFVmGHmFA0zfn62bTnk+CMAeWszpP0R3RhViu0d7cSI3b3esp1KO5WftaEk7hCn3KJqAw13GamevZu2/rsfzrOzX/GndbVhmPa7oBHTEWyH4cufiAz4LqW4apfM9PK2orGOS0W3DJBjuMzh8llhWMU3QQgRjW8TUcozJjJay0dACEG2bMqMzgj1MzSI4uIgT0j7DRasQWt2lBPBurU7D+mpmAPUCCabW2XZ39ZkRIXoVOBG5ns0n4qx0uC1K5WIMOh9kKxGGG9a32cxD94Th4kZUMZ3v3L88gVNosDsHAZgoQeKrQ0jKLLLlBGobRib45sDC485iT7V2umWIoSYmNdGG8m8gOE5rbjFijbbtNa17ueEbDTLFEvCXIsHapFltQ6gbBkBupLyvRgB9Wz8Ja4ON+6gK62nUlHPvZ+0y9xupxn+UrJQECN7tha0fR+WAuT7Yv/4Qs9l9O+tZOJh5AJJ/0QoA+6K9CqmQUqXpKkhSG4uUKm97Jn6qK/N9gU2t9ePAgMERcQgoyl7fyEMW1+BKvMV9hQU9vZCMi0lri2yerCcmIb41VYLlzMCzirGmvgBQ+I1OhTwx3shj8i5zmF3N+a3ogNx/eeFWojw1gYKUC3xQHqGdr4uricClAQVdWamriqtxMEVEM6aB3DI9lqBbyCsKYgSAwP565uyZmn6gyMIeKclNrtW/CGjOXPZMAqdQFCr51Q6pPfKBsMlqt4qig/TP3uYTRMZAFaWdUoEYGLP83vMA6EpgiX8Xcn5PO1TQ== x-microsoft-antispam-prvs: x-forefront-prvs: 096029FF66 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(346002)(376002)(366004)(396003)(39860400002)(199004)(189003)(1076003)(72206003)(26005)(6436002)(6486002)(316002)(2501003)(52116002)(6116002)(3846002)(486006)(25786009)(102836004)(76176011)(186003)(476003)(2906002)(11346002)(5660300002)(105586002)(446003)(256004)(106356001)(6512007)(9686003)(68736007)(71200400001)(71190400001)(7736002)(305945005)(86362001)(8936002)(2201001)(478600001)(81156014)(81166006)(50226002)(8676002)(99286004)(6506007)(66066001)(110136005)(386003)(53936002)(14454004)(97736004)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB3989; H:BYAPR03MB4773.namprd03.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:0; MX:1; received-spf: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: NfK6GxQXBzNQQrVYGuQDC+SdunPlFnf9Y7Bju7gw84aQYGfVI0lql7WLvqyDbuudgrYUfrPKe9N/kJC/DhAQzBEubpIpBv54M6H2DYXPVgjP5SCWQfqAwYs0nMdkWPWtl1W+Di+7fkjoa4eXgb/qqyYVtQMDcnfX0lv6UnF6Tdj2OGTZSPYsR4IHWfH5vZVATGDhLUoOu2oHlJJ9vfGHEONopJLXcilx8XmBbkYl+6BhAIzFhF4pPKk2/25ONYRYk5nrHwZOA2NTalBBft6tM8K4dBbadHv4IVN0FxBY0H8mlB4YyuNzZzaJHCNqQtgSDMW/wQNFLkNa0IJrcgXf/px1dTe3k2XLbHHvNBRAd9L9ONvwAt27e3tAM3cpIaqww68lDIySBXTkuMHmYLoTdJ20zst0f4IasgXbiANCSEA= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce042779-c1fc-4253-cb62-08d69be1d522 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Feb 2019 11:59:13.7848 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB3989 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_035919_397585_47E97E7B X-CRM114-Status: GOOD ( 10.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Currently dwc host doesn't support the remove, but nothing prevent us from supporting it. Save the root bus for clean up work in driver remove code path. After this patch, the dwc host users could implement its remove as: static int foo_pcie_remove(struct platform_device *pdev) { ... pci_stop_root_bus(pp->root_bus); pci_remove_root_bus(pp->root_bus); dw_pcie_free_msi(pp); ... } Signed-off-by: Jisheng Zhang --- drivers/pci/controller/dwc/pcie-designware-host.c | 1 + drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c index 4831c12fee93..ca45a4471ca0 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -496,6 +496,7 @@ int dw_pcie_host_init(struct pcie_port *pp) goto err_free_msi; bus = bridge->bus; + pp->root_bus = bus; if (pp->ops->scan_bus) pp->ops->scan_bus(pp); diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 3be7ca9f1fc3..cd92ded606c6 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -182,6 +182,7 @@ struct pcie_port { struct page *msi_page; u32 num_vectors; u32 irq_mask[MAX_MSI_CTRLS]; + struct pci_bus *root_bus; raw_spinlock_t lock; DECLARE_BITMAP(msi_irq_in_use, MAX_MSI_IRQS); };