From patchwork Fri Mar 1 05:03:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10834471 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 A2D7E1399 for ; Fri, 1 Mar 2019 05:03:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EDF42F728 for ; Fri, 1 Mar 2019 05:03:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 825FE2F72E; Fri, 1 Mar 2019 05:03: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 E22102F728 for ; Fri, 1 Mar 2019 05:03:37 +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:Cc: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:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iShgbJgSh8Z9Z5xriiswSfF1T2jlVluH1wRXiXpiSL8=; b=NkdCMIK0WZXepN H8dpKrRyi+Eur5IuKF4UktJZjsFDC1g6iAs/8KD2g7jNoVuQkXWVmVyfjJMCtXCgcocRzPGdGsaXv pxJ8x9jkCb2+GtHLoQGlKrz/HuL3IVDBkMye67KVIcfRlW6HTSdsa47xy/u0lPMBGAThUgLIKhsSu F1CRn6fAcpoJUYcyulrtJgAWBxjogStUfWOv7jv5JWl0ArxwCDeM5SUQZZ3SHW/62WsUYHpRP+/e1 yQj8lSETkQkM42OhLvIuJdMuoLjLOEwtw4Sz+nAMlFtmtm71BqgADn7gtPKoAx26ODbfoS0OtAncM sC1DOElC96RORYWQCPsA==; 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 1gzaKa-0006pw-VY; Fri, 01 Mar 2019 05:03:32 +0000 Received: from mail-eopbgr700087.outbound.protection.outlook.com ([40.107.70.87] helo=NAM04-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzaKX-0006pI-GM for linux-arm-kernel@lists.infradead.org; Fri, 01 Mar 2019 05:03: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=GLJ+7n76v5no2fVLihRLttvC7XT4DSHydHDSGRjxfdM=; b=qiC1GjHeHCc7BkDhNJ82jRSm+ZX40u7oUZCHFQetuE+StmiVUzPLoQMKBvTJr1rlCkKYwkmLa7DT07PFnFmHIrYcrHF4AIs6M549lEs3PgUlR6KadqpOUGoWc850ZAWn5J+ROb/Cgt6Iee5grnYy0wYKbCGQxalMnDKyVkXiYWY= Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by BYAPR03MB4533.namprd03.prod.outlook.com (20.178.50.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.15; Fri, 1 Mar 2019 05:03:27 +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.1665.015; Fri, 1 Mar 2019 05:03:27 +0000 From: Jisheng Zhang To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas Subject: [PATCH v2 1/5] PCI: dwc: Fix dw_pcie_free_msi() if msi_irq is invalid Thread-Topic: [PATCH v2 1/5] PCI: dwc: Fix dw_pcie_free_msi() if msi_irq is invalid Thread-Index: AQHUz+waTBymEGCS70GGZnCc5RmlDA== Date: Fri, 1 Mar 2019 05:03:27 +0000 Message-ID: <20190301125625.4e15d869@xhacker.debian> References: <20190301125510.4e2ee985@xhacker.debian> In-Reply-To: <20190301125510.4e2ee985@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: TYCPR01CA0105.jpnprd01.prod.outlook.com (2603:1096:405:4::21) 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: 90f96ce6-6fe8-4816-63e7-08d69e033d38 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:BYAPR03MB4533; x-ms-traffictypediagnostic: BYAPR03MB4533: x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; BYAPR03MB4533; 23:QRcYwvRolWDqyMXs9SeAyoM+KrwpNpnca0EOVzkVC?= oWvRpciCQbSxrxWxrpLX2bnkVmN8utqEIEang7q0LVIAtyrCOg84sof9Ilal1ICz0LUSeIBeBM1FSzemF7LGhtxQSy2giBXA5X8RA62is7DOJhZGIp4vSVb2smY/aDfB+bsVIoPHdd214KPAf3ah3gloM1dtRFH71TnsIXk+4QMO1lvWJwKHOYz6H+cM4NByvtiLf+4JeSx6tFGA4KgWC0extc8qUVuimZL1qLaTzojnZaKvheQqkPch6wBSGdFQ5+B6fqxi4jHTohQ535c3MD3qnph4QjYwdLUfkmpYnISVoh86DyzKct4KR2j/yU9ERxSKdl3Rlo94onOOJPWBCeRYSv6q4qD44LUcOpOPeDptdtsftVuTDQ5TFD/s7qvcsBYsLhJ7HHx6IoWf+vGl0SVueMDXXfgvKBe253xHOn4QkUpgESSHWdrvRa/JN1JBAaAEe9dkFgfUH5DfH+Dy8y/oC3DuffWexsek1d/T/46FpgM4M1Zy0S6wNY+u7d3jowoG2nBD8D7X1stAAJmY5eBeQUzhAQgv6Q4Oo6xWe9w7Du+WmeZjynvofVZNBaGStKp7N4ZJKZGI/ux+KBmAchlouyJ5F3QxE3W6FQOMW9Plj+bFod6wMcaLezCUKe9Ov8wzOVRLDC8/mI0Sx6BPS8aK2yP2J+2UWO8LyTr+zha6D3tZwJpkzRFLAXAgVfFAUu8m8w3ze0Yf9xNrNMsCLkrPhWez9oShKp8bTyNyscLPxyUUjNMBLoRh3c6sQ1GQEW1LVTm/QG9B3Uwpanm9z9sX/jbl0l72ycDHp7/s5OS/G/Bi3FAQCbBkzPMQHwHM/MVBg3AUODjHDLtcP0tm26cjDJ+8+RUkn5pBLhvJBXKCpjTQBqQX0gRy1YtrbamfJv5hF5RVzTizHIT5Pk0wRjY+tn6p1EEJ2MZ9K7WfQPTghlIrZ/yERaHlDU/0C2XxI17jkp9TEU/5UPQX9zafB51QZn+3eCXDpqJCk1r6nj2XQLYUotAgc5Y9dL6Ktnja7DpEjiyA0rmI47u6Bwt53GR3bLdmYsdx4EcEP9KueOzGWa9V/OcOt8Q/yG+sIaprLAqFUXqKicNKw6JMCrkhE7QYA2OoJ2qwIGx3chxLMtcK/SmQ2Xv51YQ3Us2IPCVeD++DTTae1q6eja3HOwMFvq6kfxexcqdAlMUW8vmclNNb+w3kLRuIiwtrTbbhUhRUiI= x-microsoft-antispam-prvs: x-forefront-prvs: 09634B1196 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39860400002)(396003)(136003)(376002)(199004)(189003)(86362001)(316002)(11346002)(97736004)(6486002)(76176011)(66066001)(25786009)(4326008)(68736007)(102836004)(50226002)(4744005)(5660300002)(476003)(6436002)(2906002)(54906003)(1076003)(9686003)(106356001)(7736002)(386003)(8936002)(3846002)(14454004)(71200400001)(478600001)(71190400001)(186003)(81166006)(81156014)(6116002)(72206003)(256004)(446003)(305945005)(52116002)(53936002)(110136005)(26005)(8676002)(99286004)(486006)(6506007)(6512007)(105586002)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB4533; 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: 8g8J+qdS9g5TUTWCMDCNBrK5eAT3MPnwAiVvmOvC9Jw1NpEjWD+3nZKfsVC2ILbu0FRXy2TlmZ+Ay8+ctJ1UUyFBUrj1H+6qynBspv7XyOBgLjT9qUAHqZI/e7Ri6Qv+oMtLswpv+pc14FMNcovVv3S1cdEVQDxNOJJt1Ugue2IKJCWa0SIdgwUh4rQ3NK6LmkDrJTyaQ1Y51rt3QQ/0ef71SOD6T9PQtlp9/9zJmMzrGdYPQOdciRqchLEln9CqRbTFxR7zmJJqUExCIA+GEhpCpwuhCCSR/8lZZ7P508oBZTnMInSiARO34nY4cYEbHt+SJouv3ybpfielUPC+S1C2CN8+nzuM7Rru4eQ6ubTb1T2YDkOgrJUDJRtyuDed6XmJ/f79RsZtfie/e+bH9SHJZypl1RC90LRQrpN1dzM= Content-ID: <0A6E8DFAE4A6AE44B8D06088BA71A512@namprd03.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 90f96ce6-6fe8-4816-63e7-08d69e033d38 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2019 05:03:27.2282 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4533 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_210329_544673_ECFBE8ED X-CRM114-Status: UNSURE ( 9.80 ) 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: , Cc: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" 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 Acked-by: Gustavo Pimentel --- 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 Fri Mar 1 05:04:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10834473 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 0C4181390 for ; Fri, 1 Mar 2019 05:04:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9F7D2EF09 for ; Fri, 1 Mar 2019 05:04:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE7222EF39; Fri, 1 Mar 2019 05:04:18 +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 88D4C2EF09 for ; Fri, 1 Mar 2019 05:04:18 +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:Cc: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:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oCbWs20lVQyGWVHDU7oeJAl2JVgJ/p+3KNxGK6PP/+c=; b=iVhx2s7Tx+vR4V fWUHZkGu0gFtE46wSs4htc/qR9/7J+8gTlbu+yuAeO7owqDwmWMA42fZps1o3fXcPmqNhkp647yi2 gnU7qSYk8LuSRs0bJ5WcOeWz2f9tPvyhjyS+QGIyISR9tOxfTsuDGzmowPNCX/CFJAOutLB29v9hZ FETgPeiCPlr0ztFUGiTrSpceKa0lkevLR/w9flJJGd94FvVxswIKiCvi8lbMnnfi/AzVeMCYQtlPj ItJnFv6G1mnDZUyxVFI9I7v1NkndSGjCFpoKx4h49JCnup66H+caFBKgEJtLR+ib09AmU+9Ns/tql HC+SxtOMPE7/EPiEUhFQ==; 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 1gzaLG-0007NH-5E; Fri, 01 Mar 2019 05:04:14 +0000 Received: from mail-eopbgr700046.outbound.protection.outlook.com ([40.107.70.46] helo=NAM04-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzaLD-0007Md-9c for linux-arm-kernel@lists.infradead.org; Fri, 01 Mar 2019 05:04:12 +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=w9U/ygVTDRpBZlzd/E/DLB0reE3jXxIiTgP+LVEI04SCve2cc5k0joGtc2+0ad8hy7DGrEjip0bgOLv9BIVLDJJKXFuSTECwFhwNmnF9TN2vJndYTtJFHUC6BM2kdOKccJW108pJls2ouuNWvC0s1Z5IhuNQBEZzAgfc66nFae8= Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by BYAPR03MB4533.namprd03.prod.outlook.com (20.178.50.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.15; Fri, 1 Mar 2019 05:04:09 +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.1665.015; Fri, 1 Mar 2019 05:04:09 +0000 From: Jisheng Zhang To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas Subject: [PATCH v2 2/5] PCI: dwc: Free the page for MSI IRQ in dw_pcie_free_msi() Thread-Topic: [PATCH v2 2/5] PCI: dwc: Free the page for MSI IRQ in dw_pcie_free_msi() Thread-Index: AQHUz+w0Gr/59ysaiUqI8xDUOx+UmA== Date: Fri, 1 Mar 2019 05:04:09 +0000 Message-ID: <20190301125707.73563471@xhacker.debian> References: <20190301125510.4e2ee985@xhacker.debian> In-Reply-To: <20190301125510.4e2ee985@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: TY2PR04CA0011.apcprd04.prod.outlook.com (2603:1096:404:f6::23) 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: 533dc7b9-6ae4-4055-455b-08d69e03565d x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:BYAPR03MB4533; x-ms-traffictypediagnostic: BYAPR03MB4533: x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; BYAPR03MB4533; 23:lupy0sd23WLjsF6076Key36Bp5TaWyhrEgor4ZwbB?= yaya+NK16/Y+RaIOEmYrJI3ZGyzWvbqSDujEQWD7o5wACveCmMRVWSQxbK7RPIs6oFpIYC0JFHg/FALbq7SNxsX7RqqQBUPugfTjk59XR/EkjOkBHBXPMeqyjPW/9VWYCcGulXp6KaZA2lNxxYZEhI2Mh2mNh2h+ImLRrCwdo1psbN7epIO0fpJ3k377ore2wg0htKgYrXdmoa7daYbmFvZuDp1eMDkEGacZ28W7n6nKe8TRJmLqtPMEH8A03yGpLQARlz72lOShZIS4hpDJgsxFOBwge5azCMEmZaAj7jg9LVLthuAG7rjqOj4DvPh68wQJxa7um9t+Sdc4ZgtE2Ia09uv+aZ3fX7ZSZT972yPUWD2l6nHJtyDUHaThTiVRT+0p6TJ9agB6050/dO6/eJYHX2saqV939gHySJq3boBg/LPv6R/B6JpZmFiBmKwwmltvfGt41dkPwtAAY+SitTG4G4ilNQm9bYxam5YciZ+yqsXdiE51abXZ7IKyX8DZJMkRNXgiRNwp5M1q6s/Blq1WvTfxXlZwGdvXPTbWhHylfQmJZJV+CrHJuNDy6xtiV4EdSEKTPkBjJMHyoQ0pPiSW1xDzF7mpgYfGOIof/h7CARrHadNfyGqGGhUAwzddOpv4QepxB6RwrCQDJE1BvFGZta/xmJJjDG3BAZK/B34yrg8sctJJ8mSwTW2DKHIJdwZk8PFz1Iruf6vqtKJeWvm10gBsAlQQbMANoqSraKWKUjsOyXozYPdKgG0M28AHJ/CoJQWydcOcQ2hAWBNsg2hGGRQGiDyGNBDjDmA+s+R7O0R5dQGrvDEGiNpjeJTteQACrbIA8vVdV1QX6xcl/3exyWwkO5PN1BEDdylVwJOzIoTlbKzmf4WGpNFDH1+YQDbwTfFKQ4pu4lZf3tFH3qTsOurVYl4o/EOJ+3OnJ2ue0Ls2NBMWNBevC8JLnrU1/CdxywnPzA183nprj2RpcWD9QUhpwRqUiHDpD67E/SK5sWBt7bsgz2O/0gj/C8OsPLA9jXOweC1T3rf5Y2CP6VNjHSIoGsYVcku6Lap7Dgp3U/z+Kan4NjkvX6BY9K8jh9/3xTGyM4mUADkNeF+tCbdvvecR8p0BoRFl7MJlrSPDNCq0CnjRX5FNSy6eIdKTotDLqdRM2QS6YGsY87wXwmAR12TUdk9mNasraroLLwCtMCsxKoYfajUok3K3SpG8sVUJ1qMLFWYocCO4nf3I5TpCEfvJFVVbfEjy02j2qMvzMduHS0tCXsca91p6wO7U1q9aiS+ZOK4hJzSaNLjkIdw x-microsoft-antispam-prvs: x-forefront-prvs: 09634B1196 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39860400002)(396003)(136003)(376002)(199004)(189003)(86362001)(1970100003)(117636001)(316002)(11346002)(97736004)(6486002)(76176011)(66066001)(25786009)(4326008)(68736007)(102836004)(50226002)(5660300002)(476003)(6436002)(2906002)(54906003)(70486001)(1076003)(9686003)(97876018)(106356001)(7736002)(386003)(8936002)(3846002)(14454004)(71200400001)(478600001)(71190400001)(186003)(81166006)(81156014)(6116002)(72206003)(256004)(446003)(305945005)(52116002)(53936002)(110136005)(26005)(8266002)(8676002)(99286004)(486006)(6506007)(6512007)(105586002)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB4533; 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: E+A6BVOCD+VDayczPH2qOt4LTeZUucotoYXZjUcoaVtGF2WycUh+ZoaEKCmz4NxQhkSJ7aPIPXd/GXpyeaTHim7Q63CFKX9cu9sGpjnoymvUkMSM+oGME5NgFa39W9Hx/VzIemPaNtah51BpdxZ/T7XzoHN6pv91RCUnMibWirN+at38rFgNFckUN8M1Geh0y3ey+BhvOy0vSJ2ParQE9IomRLyHYa4owPYErr4ZqyVnrinGYgLsIiqjjLLzP4FpqAq5Hmqrto9UaJk7Z7/bp4PeECgabmS3r5sHLqydM2WjJFzhRyEdu8z3UI8+xbDJMlxwzCHwXAvGbuTKJl2RsMPdAL7KHPVGpf8Iatv2bHUuGxAZ60JQmj0QVee/Y1+DTdj0MYue3QpKJroTiW7j5Yc6Iu1bpukPZhKpc4FBFy0= Content-ID: <83DE0D29CDD4F046B36B85F9615806AB@namprd03.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 533dc7b9-6ae4-4055-455b-08d69e03565d X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2019 05:04:09.3929 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4533 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_210411_334438_BB58BD4C X-CRM114-Status: UNSURE ( 9.64 ) 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: , Cc: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" 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 Fri Mar 1 05:05:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10834479 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 59C2A1390 for ; Fri, 1 Mar 2019 05:05:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 442112F738 for ; Fri, 1 Mar 2019 05:05:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 369942F73D; Fri, 1 Mar 2019 05:05:33 +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 CEC602F738 for ; Fri, 1 Mar 2019 05:05:32 +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:Cc: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:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VDb00Xryi76zhKASEjRbjb2bPlC5XnmyYmrapBo8SSk=; b=U8O+em6gh6FJ8W RUYU70Sst6OJ1DbUXgklpn9wOgxn/pr9KAGQwaVQAHnuCEjlLk5tIeJPkQ6HU/so9UJNuV0jWBtaE VA+Z0QljfhTSEefzb0f3WzsQy4szgat+EftgmnbiEOETaGbwUPRto1lNFTc3e5NElVVzaabnFl4Wa 6/w3O1eTscO9sLSCqLO6IXB3EPdbStYT0t81gGGBtnawTEapPH8efXGLym91ARLlLQQa+52s53e5Z pGWyNEiAGSKK1/lfh/kW0gOsKCApdB7Bpso98ldaoHDvuEXxqM7pz7BvabI78WGJvN5LpZgq5als1 ofuE9Loztp+v/WDIZqwg==; 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 1gzaMQ-0000wI-B1; Fri, 01 Mar 2019 05:05:26 +0000 Received: from mail-eopbgr790048.outbound.protection.outlook.com ([40.107.79.48] helo=NAM03-CO1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzaMN-0000vs-4W for linux-arm-kernel@lists.infradead.org; Fri, 01 Mar 2019 05:05:24 +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=do+JHVPxgugmat615Pj/NsozsHZGCIGBjUq7GpG3OvscFA1FZM33cpV9MscEseRnT9oiqaDVVtMChvDD5hPQr/NzLMY2iQwRkuTvj3tNOnLB/GyI53gEIlzPOQ3i+64WHwUrfffW18fmhA9omkQgJlCyMEWgkbZy7ijbMNc6cNs= Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by BYAPR03MB3510.namprd03.prod.outlook.com (52.135.213.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.16; Fri, 1 Mar 2019 05:05:21 +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.1665.015; Fri, 1 Mar 2019 05:05:21 +0000 From: Jisheng Zhang To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas Subject: [PATCH v2 3/5] PCI: dwc: Free MSI in the error code path of dw_pcie_host_init() Thread-Topic: [PATCH v2 3/5] PCI: dwc: Free MSI in the error code path of dw_pcie_host_init() Thread-Index: AQHUz+xey3xJKe30LkiEAqIClgwSXQ== Date: Fri, 1 Mar 2019 05:05:20 +0000 Message-ID: <20190301125818.1b0d7e08@xhacker.debian> References: <20190301125510.4e2ee985@xhacker.debian> In-Reply-To: <20190301125510.4e2ee985@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: TY2PR02CA0014.apcprd02.prod.outlook.com (2603:1096:404:56::26) 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: 74d5ada2-0f29-40f7-fe43-08d69e0380f9 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:BYAPR03MB3510; x-ms-traffictypediagnostic: BYAPR03MB3510: x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; BYAPR03MB3510; 23:9Dyg8rNs6gHVJNy9htt6unZPe8lqJZRxu5+iL0X16?= k41rmDo8iVwerxf/HV4jhZtEENdLxrNVSbdNEzRmI1NmaKjEimNuPV8NaPVsGX/fa9L1FODxE/2Qgz9Yt4EmW8+EWKDg8y5Uxnhy2gVZNXHG9xJAkI8ugSMhQjqgWdfBt0FWubanZa/SoDIxJf5+qL1Dp19UGCyNHQFAt7lB0zsBjVYA2XxFImscuT5tJs13M3Qk2h+QTOTPgkW8sVhXRX8VVcqGo9SAUZBn+XPkkWEvbAogzxC1480fk+8U7QRjeqVoi2Gy8MM1GBhBsLWJULXmXejf5AJC7RC+jqrg67KbeN5Bi6N84eCFIhyjX8UE68kH0GhESNRzVLsXHNl8b8SeIRRSZnv/CR+AoAd5OHz6uMSQZUJu+MmQYtfuUqv5XgGmJ+/HiNb0gTRHjphoLkMaqqy/SFa5OhUUTsdEFwbioaBDVl9+6IcMpImJwyqklvf1MC0vjg8Tj73QKPj0H8wEPvXFyGAntwkPvs1wj59lWqygQDoUhqqAq9lbkcYMPkISMC+N9gMQFtn848BBldjtz8mWcTy21WqTgtQeu9DF09NBDU9COV7V1RARglrjeHWdusuv3y6N1iScEW/7c5CumhFFXD3ysKgCPAesCZrAzA6HpfmcCIn+ZvAjxRh6qXpmUDsqCYmKPjrvsAErVkeBl79Ns0HWd32z4tTF7FwwlPyt9hKj1SkUyVi+Xstuf9LK2BFuy9+oP/WOXjR8G7evlxwzjPgUDn8tf5WiGJFUm4/trKN0hSZOiYYDQTyhBFaeAY/FMozIEzLljDIgdxHzse2iOj1+/9qX/JkXrUmF+iWEbG1T/vvU2wmCf7N9POd94NBZyXIlk6UKo9g8Yu9W01G1BkqIHAJyO7Vqi+1uAsbEjNvIWCuJ8Ny0JFLe65PtdYRnD4X8e6srOJVpyK071rziCGB52h+ciMJf0EcULegw6GVSaz5MLzq9sZDjGaYdvU8o/F16T1d7cv+adWQqCE9MWVhnRaizxe4uiEDDaxfoQGD2B7soCicdCXyZx7Z/QC2Ub61EqVVsONJeIOHa90GCsQ9pDXd418b6E5cV+ESTmnop85Kj/WK9Q/5mzyrIOHJnLNMIekhbgJLYjXSPGJt8/vrtcVg2rsUMgEbqI93oZKX4GTBwmcgu8RcW9icRNaGTV882JFj7f99att/BQv/6M0EnLQvlHtjKjK9Ew== x-microsoft-antispam-prvs: x-forefront-prvs: 09634B1196 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(396003)(346002)(39860400002)(136003)(366004)(189003)(199004)(446003)(11346002)(316002)(476003)(106356001)(110136005)(8936002)(486006)(186003)(50226002)(105586002)(68736007)(1076003)(54906003)(5660300002)(97736004)(52116002)(72206003)(2906002)(9686003)(478600001)(71200400001)(53936002)(99286004)(6436002)(66066001)(71190400001)(6486002)(6512007)(305945005)(256004)(81156014)(102836004)(25786009)(4326008)(6506007)(386003)(26005)(8676002)(76176011)(81166006)(6116002)(7736002)(86362001)(14454004)(3846002)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB3510; H:BYAPR03MB4773.namprd03.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:0; received-spf: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: RflPe6R4yhXnjvwARQlybs+4aP0nHDzyDksmCp7yFBMD/J/fqvP8VGoeMu2Bgh+9V8rH4UVtSilaLUYNsNaZ/DfE14J7a/mfbwbWI4HWK0GK81YwtbPr14+JRwKbubw8Xfb4WIVM9Bh7vtQAhPZoG1Uxpw4hm7c6OBTUZbLQLr68cjr1TxfeijJxUJtkREdVKBx9Gb1qyN5LUaICYhlcTUXBENjoiwzl49V7PmL17EkNXWwfRQFQHjRwUAh67+QtfouUtNo6Iqq9TMxAKcYjwxsMIL4f3aaZwd0/E5KKRL7IsHGDS2SF0XNGGQorAdzZDZkf0unLwA2+4P2EsSyTZEU9LztYukas1vV0bpSmLNv2EgoXJg2CB8yBe3CHLKJmf0OmsSxsS3RBij0AR+Xyct5kgXRPB51zR69tXSol+sE= Content-ID: <34CAC799F8F9A74BB70EC454E2DAFB71@namprd03.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74d5ada2-0f29-40f7-fe43-08d69e0380f9 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2019 05:05:20.8893 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB3510 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_210523_183275_9D850D69 X-CRM114-Status: GOOD ( 11.19 ) 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: , Cc: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" 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 Acked-by: Gustavo Pimentel --- 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 Fri Mar 1 05:06:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 10834483 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 D469B1390 for ; Fri, 1 Mar 2019 05:06:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEA202F738 for ; Fri, 1 Mar 2019 05:06:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B29602F73D; Fri, 1 Mar 2019 05:06:13 +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 57C002F738 for ; Fri, 1 Mar 2019 05:06:13 +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:Cc: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:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hchVaLN55yfml9sJYohZGVIBoHS9FYCIu5f8HzV2y3Y=; b=aUNgAB1HKn0yp4 zjPBZOustat/weTeWhXN5lMnZSXnN+CkZFjWVfX13YvwD0tYel/94hs9mJMFNsSijbOw/ByWqLwBI 0aDnVnWp4mL6ObKyvG6aTvV2vNGjAbDMpd411y39fdMaTzikaXwcaJO4IOeu8FmS8+DKwmij35SLF Ejw8NAo03j7/vSA9JI1TYkT9sxl0QyAiZHA+qaIv1OjZf8CYpSbh+pfzH0BPCOS2oqJiRV43ZZwum /11aQF9qfnS6i0dSiqCdsrE96ja5z6jZX2GLMPeKw3LAox06h864CVhrwycmCkkiTWldmHTnl2ulx tSGyy6U1RuVWEq7PiB1Q==; 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 1gzaN8-0001bx-7U; Fri, 01 Mar 2019 05:06:10 +0000 Received: from mail-sn1nam04on0615.outbound.protection.outlook.com ([2a01:111:f400:fe4c::615] helo=NAM04-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzaN5-0001NI-9B for linux-arm-kernel@lists.infradead.org; Fri, 01 Mar 2019 05:06:08 +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=WjaFSOTTXdm61wKhPwECiT37dHnQ8eMDOQyIFNIcniUmUvTkZw6mazklxSZOabaCQ6xv9XCXOBZdtyzQMEIEEJBncndqAquEvxAHCY4lzdxKzVj5LDugIp0RXe8oYbZTEJY3eufGfJT45dSM+SUl/RXJc0kaUNIYSES7OUHLN5k= Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by BYAPR03MB4533.namprd03.prod.outlook.com (20.178.50.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.15; Fri, 1 Mar 2019 05:06:04 +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.1665.015; Fri, 1 Mar 2019 05:06:04 +0000 From: Jisheng Zhang To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas Subject: [PATCH v2 4/5] PCI: dwc: Use devm_pci_alloc_host_bridge() to simplify the code Thread-Topic: [PATCH v2 4/5] PCI: dwc: Use devm_pci_alloc_host_bridge() to simplify the code Thread-Index: AQHUz+x4rd+EJMsrS0mSjARO970vsA== Date: Fri, 1 Mar 2019 05:06:04 +0000 Message-ID: <20190301125901.5ee7730c@xhacker.debian> References: <20190301125510.4e2ee985@xhacker.debian> In-Reply-To: <20190301125510.4e2ee985@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: TY2PR01CA0067.jpnprd01.prod.outlook.com (2603:1096:404:10a::31) 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: f9c2177d-ec54-49c0-fc5c-08d69e039ad1 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:BYAPR03MB4533; x-ms-traffictypediagnostic: BYAPR03MB4533: x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; BYAPR03MB4533; 23:McDMIRp70j32p0k+s3Z6YZb8KgIQJPMgY+DypZ8LJ?= 1ZMjVdxDsJiregkQz1vWntJEgI2ifMZdp95Gz+G47OWcT/77L1Ty1H06Z0yXBx/Lc9dgLytE7msM3lGj7qIgpbiPyauldxjlIDChNxRdhjfX9kDKaFkp2XWV964YksfwV2f1D4mJWVZbVSeeB7U1EvvhNb8zd3YtX7/kXsAyvNP9UodzgfsfDU8PJ2uisH8J1hdlD5Vwci4QbvmohTAJb1jpNWD5fshcOWpKNdS9O0ZCPPppxZ/QGw3vxypgN3klIteXRMJCFcF1gC9cNzBPRXrdPDUAmfh1KO4HXVQ/8mCPRWu4GFNvf8ft/bPjWugXXsIcPqknv3cx/Yx0Uscdz0DcJbKDqoRyCOcmmali7sN54UccEii/Ym01muckRvBRN0mARXonwyS76Dcl5gpAbJhWlNuTb6d5ntBKdzuKPN79qzgm1CzKa7qM60EqBhnUdQk/9OBBbw/+3Qx0dvdNXiehs+TBiZnrtQiHP6hsnWkaD/tlPdtkNDIs1B2CZRMk93RSWA+r/T/K1M24aN14YL2WItDvElo6f+G5eOeafqPu4iXcfHhrcE3O5MD1OC8flehCP9hYZn6a7taG+sysgPP+T1+oQ5Ulws9w0hNDVxGsAW19SbLXwT2kYVYOXtYLcxNulYi/JBhDZTc2GWOXrjT46ryT077tqEG1NcpSTalyJpdM6UzRx4g6oIOxYhDNT/L1l3z2/i1rOdwiSN1VSOPi7J9EClZ5HRZ9Unyw3ihpweIi1Qg58aVewhx5+XSPg3cd2rApFWlUEWx4kcQUeQD2vrElUAeU8JJL9M4jMZS1pbLt5kVHaIlvHHVncv9107BDIycL2bPPRkXO+JzGJZ+5T9nEVVmVs4gEnNQgxbZuEISMp16W5fYXwEBgxcllGCLTMVuce4Zgq1Jo022NjvKWr+Ok1qL8jSphc4QF28FrPvzjiGC1qSeAKyx4Nx+caZ4qX9LncrE4Xo34ryC8cMAb5hQoRdeVMlwxG6ITKT7itC3P+rADJHKaW5FlsGsBHjOgPY/cJ7N+embdpvPOYEcpsxwsba8sPxC3OmGHCtRFR7Cdk3vFIDAfbFhcAbXlh5xk6R3AwtTY46S8CKGCLE0Rhl1V0/OxFSibXxYQq54hN0ynNFOief4DkT1yHi+JJGwuN4PcqADxpBjVdDZJTB3R5d5Pr8+WAGTdagOL8fUxpzUaZfuOqIBDl9+nIyJXTk= x-microsoft-antispam-prvs: x-forefront-prvs: 09634B1196 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39860400002)(396003)(136003)(376002)(199004)(189003)(86362001)(316002)(11346002)(97736004)(6486002)(76176011)(66066001)(25786009)(4326008)(68736007)(102836004)(50226002)(5660300002)(476003)(6436002)(2906002)(54906003)(1076003)(9686003)(106356001)(7736002)(386003)(8936002)(3846002)(14454004)(71200400001)(478600001)(71190400001)(186003)(81166006)(81156014)(6116002)(72206003)(256004)(446003)(305945005)(52116002)(53936002)(110136005)(26005)(14444005)(8676002)(99286004)(486006)(6506007)(6512007)(105586002)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB4533; 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: 4GRaJSnkEqVifUyv51EcpeU9WcRoz4xph7BBlVcu9lOl/ySbN/4llfjBg2LthhjEV8cqRwtS57YYe5EatNfBvWUaZbh99qMvZtMVhC4lQilsYNj8/WLFax09SeL+MkhrixMujiyPJ+TlejWhVil9f+xahYeR3KOg2P6aLk7RVOlIhUhjRQo/sAvjBPPMkJDtVtSd3vpLCCP9JHmva55ugKX790D+uFG1RNfgtOgO0bA3s6Zt+QboC+JppaMvjT7nefXiF8cQL9OfXUcJ7e2Dzm31H5indbL31ScMQcWPL4tA77wxJHk29ipJjhomRA0FWtoI3wFrZyCNVQppvL28RyisIeMhZDUsmbY+cIoerUpI1AZoeg0yYe1MCq9OfJyuRsAf/ZWVg/TS02TLKqw/phrNDnV8LvSvhLhC62gSs9U= Content-ID: <6EF85607DCB3D841953513D440F871F8@namprd03.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9c2177d-ec54-49c0-fc5c-08d69e039ad1 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2019 05:06:04.1308 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4533 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_210607_404244_CE3361F3 X-CRM114-Status: GOOD ( 12.05 ) 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: , Cc: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" 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 Acked-by: Gustavo Pimentel --- .../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 Fri Mar 1 05:06: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: 10834487 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 5A10C1390 for ; Fri, 1 Mar 2019 05:06:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45E062F738 for ; Fri, 1 Mar 2019 05:06:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 372F52F73D; Fri, 1 Mar 2019 05:06:57 +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 D1A6D2F738 for ; Fri, 1 Mar 2019 05:06:56 +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:Cc: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:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aHXf9yFRTJK1snwd/j3WDOp6JHuv6qVefUrw4HC88nQ=; b=Ss8FV3DqtPHmPQ L5W16DcUxD7HpjfmRcN5Ae6oc5J2C8lhzDUCGShaVIND2cf3uZkY1TOXLd3sox8tW335kFLZ+bUTJ wCrTNMniBZQ+M9MTIVq043jxJjXyvjcm/341qtoCHJ/ZVs7TtG8khxxrShaV3ddgiqIzPb2lWDEUk 0hCs+9zGGCWHpONi7X1L0cfdj9pnRRKZjGaFok67Wa/n9+f5q2nSep/Fpx0CY3P2slcWvZMahKbvC 0gTHvj6DVr59b71z5pxftpJ7V/9XHnYiUcBC9CmddX7QxFwFahrsETT9YCa9PG8bg8lrzu7OoBvtd BBronACSKoOtQdFCu9pw==; 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 1gzaNm-0002EW-Tq; Fri, 01 Mar 2019 05:06:50 +0000 Received: from mail-eopbgr700063.outbound.protection.outlook.com ([40.107.70.63] helo=NAM04-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gzaNj-0002Cp-RR for linux-arm-kernel@lists.infradead.org; Fri, 01 Mar 2019 05:06: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=HDfJa/5peeKUsjb5cZhVZj4vd75dEAlF9WieijY3ECo=; b=qjZrbe7GQI+ulV5kBg66rqrMTSVEgV6KQCQB3n7BXT8tNE7VSMf5ZUoKVHfG0nmU140qH4IACwqE9QVvdbK2UovXYinnpTwCPT75UWii1l4+FloH0lXa1k21UlXmmXTJL04v1brtgDDlxnBEOb5BWli2AAzmM41tL7SGG0wvrsY= Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by BYAPR03MB4533.namprd03.prod.outlook.com (20.178.50.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1665.15; Fri, 1 Mar 2019 05:06:46 +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.1665.015; Fri, 1 Mar 2019 05:06:46 +0000 From: Jisheng Zhang To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas Subject: [PATCH v2 5/5] PCI: dwc: Save root bus for driver remove Thread-Topic: [PATCH v2 5/5] PCI: dwc: Save root bus for driver remove Thread-Index: AQHUz+yR42j7VtHHRUKR9O0ghfmT2Q== Date: Fri, 1 Mar 2019 05:06:45 +0000 Message-ID: <20190301125943.47adae82@xhacker.debian> References: <20190301125510.4e2ee985@xhacker.debian> In-Reply-To: <20190301125510.4e2ee985@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: TY2PR02CA0043.apcprd02.prod.outlook.com (2603:1096:404:a6::31) 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: 60b36bb6-96a3-4d3e-4395-08d69e03b399 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020); SRVR:BYAPR03MB4533; x-ms-traffictypediagnostic: BYAPR03MB4533: x-microsoft-exchange-diagnostics: =?us-ascii?Q?1; BYAPR03MB4533; 23:LqzZwPSNONsoLhj8Ydd5HsuLe/VYCapLCZrF0Fsa+?= S9Yp5IgPasONFkS5w/1urfU+mK4Z0bxoJAmxKEsyLBOJv3e+ejPqBTga339bkssiwMRmmhRZ8VSY3SLnonNCA7QGJJKsP38PCWdcJ90Rb0iS6i+4TsXhNqdOQMuoUu7fu6NWXrc7919tnW3ME8pkJZV8NzRqrpGMLPAgFpvkPLF323XBcZTiUshnHyL4b3bzLnE0l6UXjbVr9z5woSPZNfHDAuFHgXIDNQGQ4oDsNewBVGVX9UZ5jRchfgKzp6vtIKPVNCb2sY6qtJea/dyRmK85HWxGFi+0VNC8ZiTtx+45/OUBSaL3fOAYk0GTCAfdPBEWDIXCr0S7hTTKkcvfwDwyHEJxFMrsJZidVD2WpZDMYxh3Y4buOWE5LlHuHqcD9+N7tHyZauOx+92QHas/y4TgFht1Pkr5lJQ+pgAEhsvuUmXfkDYi1KxqSGkImahYjbM88g5lugg7Nn2gInT5E61CFQD16QlBnLYyRNFbCzaEfVbcePvZ+Lx9lK0Ri0FPeP8S+Xa+K3msBpNMZ2ei8Zqac9qSO6Z50geuw7qF1jjP9iqyTpgGaZox/E295tZ/AJpORv6U2ECa8arauCYIp01meGJgVjxdCDgFxET17qNkSoXv3kvHll2XF6sPQluNsvV5jyo5wVJtiMjv4vcMJl0DFLqJIbupKbhRIuqm4K01RXhHqhKssCWM/O1+z50GgMpCCTgh9Sk584GzwsAFQsXiQlLl+V/py8Mt6O07x01WNAr4TQVd0tPHQdeR5UXgPFfMiuX/sYk5p0LK3SUfucRgCpSAr0CcTVFs0kQZOEh4pgvjAUshlxf0wNzO+HrWvgKKjLlt3lAaREI60HrrjYTGdrymf3EIR04rPNe5jJbaH3qRPNwHLQUDKcsEq5hGXW3TLJ88uPg5Laa5ZGG1hbAj/tYtfC/z+WVWGJLzkTJSom3nK4k1k+3ujkLEuyvtJySZcjZULUHJKKoSOX5Sink21xZ1xIb0PCT0OSNc+cMkXCUoCqVixpgG8MoisQvIRhvM9aTn3b87OhavqHmE1lbVLEqLgkm5C1LiIflzd8ZHptq5AS2UlXGrQtz7cwh+Mu6bBX+VHf+O2+e/cHyX2px1rvjK2oMpw0Y/rCRMX7eSDe4dmD3nlarGQB/b7Of/Qepgv5C7rcF58T/oz6g0VV5Ii8kYWAyeVOsOcDdXEtoBg== x-microsoft-antispam-prvs: x-forefront-prvs: 09634B1196 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39860400002)(396003)(136003)(376002)(199004)(189003)(86362001)(316002)(11346002)(97736004)(6486002)(76176011)(66066001)(25786009)(4326008)(68736007)(102836004)(50226002)(5660300002)(476003)(6436002)(2906002)(54906003)(1076003)(9686003)(106356001)(7736002)(386003)(8936002)(3846002)(14454004)(71200400001)(478600001)(71190400001)(186003)(81166006)(81156014)(6116002)(72206003)(256004)(446003)(305945005)(52116002)(53936002)(110136005)(26005)(8676002)(99286004)(486006)(6506007)(6512007)(105586002)(39210200001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR03MB4533; 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: X5rcuTo5Kb130uKY7QkJ7wKqSiZ0U5G+VoIz+Vl2Wnp2vK2DlF5Er5LjiTn09zKfY1yiGlhRJ0R4qxrWZqVky3FAqlh/KbTqvC4MH6dSOd/YQWStTWUh/C5zsVZqkdy3kSbhSQ6UeIhivwgSTENQrxJmLJRBQz/eie5NBdRmrX4a2l3dcWvG9BXlIt+4CLZnaae5RRe4q0cJmCj7QsKFyKAJw9R9II/nrKNghBFxCu8wHsDtt3dg1UeSIGeu0gtr1ov7Za3gHWN1jz5O9hnjvTkFnzp1+5INP6LAXyiJF3aFQyNGq8LIfgjjWFZBhxjSOIsPWkzuv1GAIZsjcQ6YVtuJrxg2vbqslM4afNRDzcM56PakF4YDTO8vYINlDHABQ4m9C9LbSD9YtVw5us39JMXHbDNw0TUqANOmiJ1CwhU= Content-ID: <50863B334B294B4CA01863E2F6F8572D@namprd03.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60b36bb6-96a3-4d3e-4395-08d69e03b399 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Mar 2019 05:06:45.8022 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4533 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190228_210647_885139_7AB8CE41 X-CRM114-Status: GOOD ( 10.68 ) 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: , Cc: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" 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); };