From patchwork Fri Aug 4 03:32:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harunobu Kurokawa X-Patchwork-Id: 9880371 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 649C2603B4 for ; Fri, 4 Aug 2017 03:34:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F51F27F17 for ; Fri, 4 Aug 2017 03:34:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5397528515; Fri, 4 Aug 2017 03:34:01 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD46B27F17 for ; Fri, 4 Aug 2017 03:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751986AbdHDDdq (ORCPT ); Thu, 3 Aug 2017 23:33:46 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:21081 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751921AbdHDDdh (ORCPT ); Thu, 3 Aug 2017 23:33:37 -0400 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie2.idc.renesas.com with ESMTP; 04 Aug 2017 12:33:32 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 809FA559D8; Fri, 4 Aug 2017 12:33:32 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.41,319,1498489200"; d="scan'208";a="253456332" Received: from mail-pu1apc01lp0023.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.23]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA256; 04 Aug 2017 12:33:32 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=hArixjXic1v4n1SSwKtSjkESjynjhHdlZOCZdBlGfFE=; b=WhDU6E0eCaLMGTJykPrfAEkx0jNVi2FmnPxt4/0d0RNNt9b+jSFS8NFw0ZFQBM+ffRO5CSDsg7gCYZgWSd58OFlFQ72L/kLDC3rnOgnVKAT2h2aPJUyOBjk4WpdlgN+c7IWY/7vIr4i6wiWm/EBK3ssyNw+DYIIeHQSpFHo/4Tk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost.localdomain (211.11.155.138) by PS1PR0601MB1467.apcprd06.prod.outlook.com (2a01:111:e400:c48d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1304.22; Fri, 4 Aug 2017 03:33:29 +0000 From: Harunobu Kurokawa To: horms@verge.net.au, bhelgaas@google.com, linux-pci@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Lorenzo Pieralisi , Harunobu Kurokawa Subject: [PATCH v2 1/2] PCI: rcar: Fix error exit path Date: Fri, 4 Aug 2017 12:32:54 +0900 Message-Id: <20170804033255.27171-2-harunobu.kurokawa.dn@renesas.com> X-Mailer: git-send-email 2.9.2 In-Reply-To: <20170804033255.27171-1-harunobu.kurokawa.dn@renesas.com> References: <20170804033255.27171-1-harunobu.kurokawa.dn@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.138] X-ClientProxiedBy: OS2PR01CA0123.jpnprd01.prod.outlook.com (2603:1096:602::17) To PS1PR0601MB1467.apcprd06.prod.outlook.com (2a01:111:e400:c48d::11) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 074d9dee-8547-49b4-7a4f-08d4dae99399 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(48565401081)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:PS1PR0601MB1467; X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1467; 3:UBt40VgsDHtLuqqgmGzFIlDKHVVHfpvpYO2x36/tig1ZBHnOuCd7C8ieomv16k9ghTO7dTxKxQKEnDf4bjZ5Ad6u7vM0oY/IzPmDp9xsY/X/LN7EjoNd6zPzb+O/nxdZ1T6wtc90qrJxO/jcO0QOTFXfx4MSbjLepq0rQT1YB6X5GbpafDI3dRybtKw3srVLfKC4AGSWpOmDJBKYIVduPLw6m+qAC+mFYeD5vIknz0YBrnf9Z8rVuClgoz5kN40T; 25:zzKFc5fUL7prQBs/udL3GvVivqCcONm/J3DolMnwTpL9K5xiwG7IUtrAXtL0ufORRDB12rYkcDY8t4yCDOfd2g8bT7vOHb9LKW2eJaoezouqtqx9Bwk3pUX+kHP5t5WnCbRtoRPQcv9yxFgXALaffoqFjU/4ZU/gHP1vcQR7m0G8TdWcEHrWwwr2ZWzFw+ovA52PnBE5oI2FI9A9lonhnDVORGSvBy4P4YkIBxQGHDJextuXk3IbTr3i3IMx7eMIJnkPX83u6CkJCmnv1Hi3qOmiIBUg+nWyPY8eqXpSOdoz0+4SALfhdcLyOwbx8rZejYai+yhwroGmeE35qAt9uA==; 31:tbgx50gSCaMBTVqXBy/V2DJ6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tVopr/olEo7UkJKbYMhBvksfxTQIBfQ= X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(6055026)(6041248)(20161123555025)(20161123558100)(20161123560025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061750153)(20161123564025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:PS1PR0601MB1467; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:PS1PR0601MB1467; X-Forefront-PRVS: 0389EDA07F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(7370300001)(6009001)(6069001)(39400400002)(39850400002)(39410400002)(39860400002)(39840400002)(39450400003)(189002)(199003)(33646002)(6486002)(305945005)(105586002)(7736002)(50466002)(50226002)(78352004)(42186005)(4326008)(106356001)(103116003)(25786009)(68736007)(2906002)(36756003)(6506006)(6666003)(81166006)(81156014)(498600001)(76176999)(50986999)(8676002)(2950100002)(42882006)(48376002)(110136004)(38730400002)(101416001)(107886003)(66066001)(6512007)(7350300001)(54906002)(5003940100001)(47776003)(53936002)(189998001)(97736004)(5660300001)(1076002)(3846002)(6116002)(3720700003); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR0601MB1467; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:0; A:0; LANG:en; Received-SPF: None (protection.outlook.com: localhost.localdomain does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; PS1PR0601MB1467; 23:S3i+hCnWr9QAqKdK8lskdW+w1vQBHGx5Ms8e6XJ?= =?us-ascii?Q?id/eKFqA5+Qn6q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SxeTxqIQx6zNIuhFhQN5PSRr4oo3KID556Wgw==; 24:INHhiAvHXw/2JwCj9lPn6knKNeito1+mKHSPVttlCWw1Ca2Ncgbk1bXV+eSMkrWbzpc0shg8HXZZ3k4+6/N1FltHnNLY0C1ECixwrRXhH3k=; 7:cRnj+dAsYp/I1twf6NoninbD8p+MS81z4ghCWhvW4S3IsuRWKJD0TYA4M/N6w466NyZFGxc+/dfz8Kn1UOLAcUhfOYbpqmeoHC91YnZ8sXEZnUGPYzOlM/r4bkoY30iRSxBH0WESEMFIxaf7/DeIdP8idxok7oLzJjzQFeF5iwd4EMfC1b5l6N6MuQjbGhkmgt/LDYJPmM9G/cQ8pNwzRdfnNlX72ISKBaLnOCptIQw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; PS1PR0601MB1467; 20:1MUeBeeK8SpRJdgJXAgU6DnbhLytZNAEzG5109NG4zRNELlCqsfkc/hVqxf6DjYZVwpRvCK1DMUnmJMmL9dFX86CaBaKb5yOfsII6QVxbSI7CUYV21+BdxlwyXSMHHQigvxiumg+upl6jO+XhX9C4kXGR/xdOzhRTcWy1lRIUf8= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2017 03:33:29.8781 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR0601MB1467 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Lorenzo Pieralisi Commit 90634e854079 ("PCI: rcar: Convert PCI scan API to pci_scan_root_bus_bridge()") converted PCI root bus scan API to the new pci_scan_root_bus_bridge() API; in the process some error paths were not updated correctly which may cause memory leaks. Fix the driver error exit path reinstating the previous correct error exit behaviour. Fixes: 90634e854079 ("PCI: rcar: Convert PCI scan API to pci_scan_root_bus_bridge()") Signed-off-by: Lorenzo Pieralisi Signed-off-by: Harunobu Kurokawa --- drivers/pci/host/pcie-rcar.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index ac80fbb..6b73981 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c @@ -471,10 +471,8 @@ static int rcar_pcie_enable(struct rcar_pcie *pcie) bridge->msi = &pcie->msi.chip; ret = pci_scan_root_bus_bridge(bridge); - if (ret < 0) { - kfree(bridge); + if (ret < 0) return ret; - } bus = bridge->bus; @@ -1190,14 +1188,15 @@ static int rcar_pcie_probe(struct platform_device *pdev) return 0; -err_free_bridge: - pci_free_host_bridge(bridge); - err_pm_put: pm_runtime_put(dev); err_pm_disable: pm_runtime_disable(dev); + +err_free_bridge: + pci_free_host_bridge(bridge); + return err; }