Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp277224img; Mon, 18 Mar 2019 02:57:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9mtdF4TiujiSitgPxV81srM1j4jdbWo4Wq+jfRe39XoV7cg1bVnPe6oiMV1rRmI5a+lCO X-Received: by 2002:a17:902:8506:: with SMTP id bj6mr18860328plb.60.1552903034991; Mon, 18 Mar 2019 02:57:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552903034; cv=none; d=google.com; s=arc-20160816; b=WONZcsawfQP82oCiDUnkY3pcJfKgWOBobCYXSmxWqnSjERUrgqtsOZXSjSRhlW5QCi CEfZz4W+YRmqpJkV2txQltkHoJ9E04rjWE+E1GIm9bVSEsy1rzbuLaBbVCkbxKH7D9nO 5HDVtzJA0pgFeb47W9qmQqnCcQQMBINJE6YhPHGZQ+05ZrZCak8he9SK61aljZ9Sxz9z brpJCNU/j3X7uyrA2L2+zudXpaca2QoZ4JoAv/83cfKyOp+k/k6oHz0Zws/tbfsfpxQp /e0pYwbkClaNymiVZry4NLZW5dnjy9cZFZG6lXLwUZshoyM3CtJd9/Z4dRmfC32qQRQo 7G1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-id:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=UhvE0+1qXeAFOcQksGpZl2UoMr49mpT1gKdIfBx/6N4=; b=sDPR1HAl9xVlnjvhxtexjxE/A9beMO8UKY/K4hSvPWfv23J4qtGliSaoDyGbUIKduu uh02qwdqjGl6eZUYhR8pl8/f819MJdStSXbE/vGFixkbW9KrkXLm1sGL3SCyrv1L+QpD Cmz3u33oOAv/UqRTQGhmx10d5vss7hMtSKtpX9vrdFeOS3yspHpOZHKCP88CT+c+K88d Rt2tt8EB8dYhmqDf0TKlgLGh00m6k8rKIjKGCWz/yG3qIO1V+Ho613cC0fIBd9u9D1yp hOEkh0ZcMb6sfeRkpVzC61gECvDp/pF+9G9DhA//7TY4VaQ/nrgQzI+/GJ3EEpLs5m/g 9VNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=MUTIQzTX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j24si5607628pff.90.2019.03.18.02.57.00; Mon, 18 Mar 2019 02:57:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=MUTIQzTX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727222AbfCRJ4X (ORCPT + 99 others); Mon, 18 Mar 2019 05:56:23 -0400 Received: from mail-eopbgr730047.outbound.protection.outlook.com ([40.107.73.47]:28928 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727141AbfCRJ4W (ORCPT ); Mon, 18 Mar 2019 05:56:22 -0400 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=UhvE0+1qXeAFOcQksGpZl2UoMr49mpT1gKdIfBx/6N4=; b=MUTIQzTX6IigVX9EyPk489TGr6ts9OoXdxSEYhx+4ckEmc9OLtIWDkQUQF0rNNE//gyF91mTCcH7Df/HhHEcq35+kvALNy6rw/PB3GM2uTrB5StOhgAzEUUYf7Ito+2LQRVkXXwcw4P9ljUMiidTi3bGHt3zkOqSyg6Y3P4tA6Y= Received: from BYAPR03MB4773.namprd03.prod.outlook.com (20.179.92.152) by BYAPR03MB3928.namprd03.prod.outlook.com (20.177.124.157) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.14; Mon, 18 Mar 2019 09:56:05 +0000 Received: from BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::1a8:1bc4:174b:472b]) by BYAPR03MB4773.namprd03.prod.outlook.com ([fe80::1a8:1bc4:174b:472b%2]) with mapi id 15.20.1709.015; Mon, 18 Mar 2019 09:56:05 +0000 From: Jisheng Zhang To: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Bjorn Helgaas CC: "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: [PATCH v3 3/5] PCI: dwc: Free MSI in the error code path of dw_pcie_host_init() Thread-Topic: [PATCH v3 3/5] PCI: dwc: Free MSI in the error code path of dw_pcie_host_init() Thread-Index: AQHU3XDNPtxLI80dvkeT0+gZl/Yu8A== Date: Mon, 18 Mar 2019 09:56:05 +0000 Message-ID: <20190318174841.522fb6fd@xhacker.debian> References: <20190318174415.74fd25a5@xhacker.debian> In-Reply-To: <20190318174415.74fd25a5@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: TYAPR01CA0211.jpnprd01.prod.outlook.com (2603:1096:404:29::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: 9f371ff8-3ea1-4e7a-fdc3-08d6ab87efd7 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(2017052603328)(7153060)(7193020);SRVR:BYAPR03MB3928; x-ms-traffictypediagnostic: BYAPR03MB3928: x-microsoft-antispam-prvs: x-forefront-prvs: 098076C36C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(39860400002)(376002)(396003)(346002)(136003)(366004)(189003)(199004)(476003)(11346002)(97736004)(6436002)(3846002)(6116002)(6486002)(71200400001)(71190400001)(256004)(486006)(446003)(26005)(8676002)(5660300002)(68736007)(7736002)(86362001)(102836004)(4326008)(316002)(110136005)(2906002)(99286004)(54906003)(105586002)(25786009)(6506007)(386003)(52116002)(76176011)(81166006)(81156014)(186003)(106356001)(14454004)(53936002)(6512007)(9686003)(50226002)(72206003)(66066001)(8936002)(478600001)(1076003)(305945005)(39210200001);DIR:OUT;SFP:1101;SCL:1;SRVR:BYAPR03MB3928;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: SKykdF2ZdTcVp+fZ2kSFJgpjY+kIfFD8QWg6vu5hduKcwZ6Pf2MYAClJaTDMpbR25NPm8gvkYMA/HdEzhLVDkQz20QCih5H9kJAiYub2IPfJgfjYO4UGIQHbmaGu/BqIUoZDt/P7V7FYOYsAwmIn4iuAW/01vPb6kXbhJv6HgCVIj4aG3UWU5BTqpaSSnoqyR/7q4Nt1mQVk4MHEAvfHk67DZLoxcyPiRXztTwf4XeWsuFd/KaWvnOtx0zgl0xeZxHGkJUdgL/KZK+4SO/fPLvatb9Q/nj/HBPyK2Uwi3G5kkMYiDSMGbHJxJvOXoQAEzOLpCmIpoicdCe5YjlNUosVkCvujOwx5j15mqNkXQ2N+xML8/olw7ZtiCoq560HTl1lk5tf7OLM9jszyJOSv6i9sYFm1YHUHD6w7QD4Q8Q0= Content-Type: text/plain; charset="us-ascii" Content-ID: <29FD94CCD3AE3D40893E8C601FCF84CA@namprd03.prod.outlook.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f371ff8-3ea1-4e7a-fdc3-08d6ab87efd7 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Mar 2019 09:56:05.4850 (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: BYAPR03MB3928 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index a71b874ae3c0..585080699675 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -483,7 +483,7 @@ int dw_pcie_host_init(struct pcie_port *pp) if (pp->ops->host_init) { ret =3D pp->ops->host_init(pp); if (ret) - goto error; + goto err_free_msi; } =20 pp->root_bus_nr =3D pp->busn->start; @@ -497,7 +497,7 @@ int dw_pcie_host_init(struct pcie_port *pp) =20 ret =3D pci_scan_root_bus_bridge(bridge); if (ret) - goto error; + goto err_free_msi; =20 bus =3D bridge->bus; =20 @@ -513,6 +513,10 @@ int dw_pcie_host_init(struct pcie_port *pp) pci_bus_add_devices(bus); return 0; =20 +err_free_msi: + if (IS_ENABLED(CONFIG_PCI_MSI) && pci_msi_enabled() && + !pp->ops->msi_host_init) + dw_pcie_free_msi(pp); error: pci_free_host_bridge(bridge); return ret; --=20 2.20.1