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:9Dyg8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VsONJeIOHa90GCsQ9pDXd418b6E5cV+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;