From patchwork Tue Mar 21 19:31:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13183162 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6B768C74A5B for ; Tue, 21 Mar 2023 19:34:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=t0FbRVK8TazIF3iBo5In9dk6p+kI2uY5P1cUqaq83cc=; b=1AN+PpGd45D+QV PSlMOyhBupp/A4VCBzjciDD1mSve8dAVGeTVmSSkzIAZFCe9rypKmjV4pshzFyp/OeLDsWe01/xOU t+FqMDPVlj9D0SPzTNB7OEfv161vRbngbMFgntNSG1/oxkB7lf4fpsIIValj5mrcblwBIr7JjjQZr 4p1HW/Gy/Pq6JxEI9yenIABMyRDqbABkeWTo7Sl93Bi4+14GJ/Cki09w9QRBeDbvjWXSYmhwP2woD sADywsAT3Mo01xMOAw1DmOCb3ZdJstZOwy8oZoY3W2cvGHdtSnAgXc5t/DPHbaX54VKAMIIctC47F qZ3pNSIGTExeRrjfJabw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pehin-00DUkx-1j; Tue, 21 Mar 2023 19:32:37 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pehii-00DUej-0Q for linux-arm-kernel@lists.infradead.org; Tue, 21 Mar 2023 19:32:34 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pehiU-0008Dx-Eu; Tue, 21 Mar 2023 20:32:18 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pehiT-005l5l-Fv; Tue, 21 Mar 2023 20:32:17 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pehiS-006qxi-RX; Tue, 21 Mar 2023 20:32:16 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thomas Petazzoni , =?utf-8?q?Pali_Roh?= =?utf-8?q?=C3=A1r?= , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Bjorn Helgaas Cc: Rob Herring , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 01/15] PCI: aardvark: Convert to platform remove callback returning void Date: Tue, 21 Mar 2023 20:31:54 +0100 Message-Id: <20230321193208.366561-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> References: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1826; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=VU8AjyDLbWZ5dqbt4iquWcUdOksnVkBSV+/E2xpJ7XA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkGgYMe8hHIINwAJXwV0g3+hkCe50iFo5TcCjOW FF9FY8qdNGJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZBoGDAAKCRCPgPtYfRL+ TrPiB/9Cr48o7v2D92yY9Ucz4v+coWwl7NN3FpOZz5seMKIw2oui8ukSNtrf/TDlIAFiYUoRXy8 S3tX7Mk6ztaE9OnEWyxS1pQSrYiQEp72/NGbvcYzkQHBQOi3aqfd/GQfCbL/yRxyt0nJCmyp4pT P29Uee/RJfW9irKdc51XrslR2qIy+VljgBSpFNSIcRQI7+hM4YNTYstT48BeCV4raZUQ7ve/iGA CP/Ur4sFICxB2KwoIk+FvlyCBIuGFZBtuqvP5aAPEGtPqEdUUMazEKoXW0TItT4lIHqzDDwTxqT h1B30eGGT3xQgl4hbbBz679DzCTB/IS865sMIYW8lgn71S5S X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_123232_204360_A8E76C65 X-CRM114-Status: GOOD ( 16.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/pci/controller/pci-aardvark.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c index 513d8edf3a5c..71ecd7ddcc8a 100644 --- a/drivers/pci/controller/pci-aardvark.c +++ b/drivers/pci/controller/pci-aardvark.c @@ -1927,7 +1927,7 @@ static int advk_pcie_probe(struct platform_device *pdev) return 0; } -static int advk_pcie_remove(struct platform_device *pdev) +static void advk_pcie_remove(struct platform_device *pdev) { struct advk_pcie *pcie = platform_get_drvdata(pdev); struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); @@ -1989,8 +1989,6 @@ static int advk_pcie_remove(struct platform_device *pdev) /* Disable phy */ advk_pcie_disable_phy(pcie); - - return 0; } static const struct of_device_id advk_pcie_of_match_table[] = { @@ -2005,7 +2003,7 @@ static struct platform_driver advk_pcie_driver = { .of_match_table = advk_pcie_of_match_table, }, .probe = advk_pcie_probe, - .remove = advk_pcie_remove, + .remove_new = advk_pcie_remove, }; module_platform_driver(advk_pcie_driver); From patchwork Tue Mar 21 19:31:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13183166 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56344C6FD20 for ; Tue, 21 Mar 2023 19:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GE7iP9QTZayZZ7sjQzjsXPCDQep4qiT0t/9ccg73xho=; b=MKVrIBXjOoDaGJ xgD8Z7FTfI6L66NWGStSqXN8d9Ui+1hOFhYSpD009Xe5QuZWG8piXpo2Q32gcrKlB31bp4ErWn8PT pYHOFAthX18fpAwJOjkqZveN7gYaYZdsjZKPhmzOGAfvczDDwORD00dy5O+mEDKkq3EpyoGFtyGTf uwXh1kcHMH/C8/aLEcMtMnx+fuz5Teh0wsIg8846wSVeCEuFCl9VO17+BWAcmA4Z3h8jBxlTni9Ot jNpym8JI7fhE1nmpBMmPyM2fU6vaaWCxhLo6UXcrt6Gt8VWH7+UqwbwP4LPv9oo9GEMKB6r5P5d/N HWfjm8vHvScVVDOySNIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pehjJ-00DUyo-2S; Tue, 21 Mar 2023 19:33:09 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pehii-00DUex-0Q for linux-arm-kernel@lists.infradead.org; Tue, 21 Mar 2023 19:32:34 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pehiW-0008EE-GG; Tue, 21 Mar 2023 20:32:20 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pehiU-005l63-UX; Tue, 21 Mar 2023 20:32:18 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pehiT-006qxt-QY; Tue, 21 Mar 2023 20:32:17 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Florian Fainelli , Jim Quinlan , Nicolas Saenz Julienne , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Bjorn Helgaas Cc: Broadcom internal kernel review list , Rob Herring , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 04/15] PCI: brcmstb: Convert to platform remove callback returning void Date: Tue, 21 Mar 2023 20:31:57 +0100 Message-Id: <20230321193208.366561-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> References: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1895; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=LYBGZGW40OZnRbX51iSFrWuG85rmJlZ6nzAXmI6Ei6w=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkGgYPQwR9aF+IaHssY/wQGVUbPlhDvNkgY132c HVVvfpYmjCJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZBoGDwAKCRCPgPtYfRL+ Tk25B/9r905dZ1CMs+zl+s62zWehNigf45KLTPf6Vu5rnejf1EusFS931fE7lnk8VY4768ybaNM KOkHypsGiytRcjxdhj9No8hWDFsW97Fp2Xq3Luv/TrEERNmYW5eUWaXQytbIK1TsoOMw8JMSiGI sOB6HR7R9A/A5MLq0ATGwXb+Slbj0QMxY0xCUPq6aI09pQHWc76QSWHJ5OeH5eTMc+hpv/Gjxhe xHdVBiK3eEh8Col/EcOr5AGcHNGKsQ7XyOufAZVrGdr0T9Nmuf48Dpf03iE8+znJ4Xxq+uLogI4 kvwLhIhrvLv2INr9tFXAN2ew4UmD54DynwJMTslrT6ieAC8E X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_123232_258053_366CDA16 X-CRM114-Status: GOOD ( 17.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Acked-by: Florian Fainelli --- drivers/pci/controller/pcie-brcmstb.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c index edf283e2b5dd..f593a422bd63 100644 --- a/drivers/pci/controller/pcie-brcmstb.c +++ b/drivers/pci/controller/pcie-brcmstb.c @@ -1396,7 +1396,7 @@ static void __brcm_pcie_remove(struct brcm_pcie *pcie) clk_disable_unprepare(pcie->clk); } -static int brcm_pcie_remove(struct platform_device *pdev) +static void brcm_pcie_remove(struct platform_device *pdev) { struct brcm_pcie *pcie = platform_get_drvdata(pdev); struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); @@ -1404,8 +1404,6 @@ static int brcm_pcie_remove(struct platform_device *pdev) pci_stop_root_bus(bridge->bus); pci_remove_root_bus(bridge->bus); __brcm_pcie_remove(pcie); - - return 0; } static const int pcie_offsets[] = { @@ -1612,7 +1610,7 @@ static const struct dev_pm_ops brcm_pcie_pm_ops = { static struct platform_driver brcm_pcie_driver = { .probe = brcm_pcie_probe, - .remove = brcm_pcie_remove, + .remove_new = brcm_pcie_remove, .driver = { .name = "brcm-pcie", .of_match_table = brcm_pcie_match, From patchwork Tue Mar 21 19:31:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13183170 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2D7AC76195 for ; Tue, 21 Mar 2023 19:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wo9DB0d6hjx/ICmKsePnxQ0unx9DOlm4m88oTWBN9aM=; b=PEARxbln823yDD lTgNB5KNowJsNEU1cmpBl/C9uFyIkEDPUGHBkSC4upWpUYIWwMOZ9s0Uakd4Iqso5CciqmrtGkI7G pFCi8QCj1e8wj69Jc7ilq9AIXng4Bt/5+LF7se7xfaRFyOSRN4SHfiuJmooRCGCx5HG/yUCqHrZrw PvsMYx10x2MZ5wUjNFndhv69lRQbbBoaxLu/YL0uxBs0gfsMF+v15AYa5vXwQNDQgbhPkERTh0QFp H+eCD3OJIqCjm18X+x1OyKbTOU0qtVquSig7TxMyusmU+FnPbpj3O0FyONEzvp+7YNbE6ebXfO32G aEtKGGMW43yTzQ7ykNJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pehjx-00DVRX-24; Tue, 21 Mar 2023 19:33:49 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pehje-00DVEA-2p for linux-arm-kernel@lists.infradead.org; Tue, 21 Mar 2023 19:33:36 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pehiW-0008EC-MA; Tue, 21 Mar 2023 20:32:20 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pehiU-005l5z-QE; Tue, 21 Mar 2023 20:32:18 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pehiU-006qxw-20; Tue, 21 Mar 2023 20:32:18 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Vignesh Raghavendra , Tom Joseph , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Bjorn Helgaas Cc: Rob Herring , linux-omap@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 05/15] PCI: cadence/j721e: Convert to platform remove callback returning void Date: Tue, 21 Mar 2023 20:31:58 +0100 Message-Id: <20230321193208.366561-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> References: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1766; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=QxQuCPkBX+gmn0DsDFMazRFbmA+rrNRdxWImQT9rru0=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkGgYQ1j3K5rYmdgPYi1zdHVXsFc9Ws6RX4oYjT S1lZTdeizeJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZBoGEAAKCRCPgPtYfRL+ Tg0pCAChO/xohQuyvJzoG0F/9IkpLTb7vcvjZRFygLGbIhNQwl4fglw2bdYVH/FOcM6Wn4u+ZJV xcA2Lgcq+OXNlCqT3U1AJhJ5JPGu80t3C2WoRuk8hllnSkv+PTWWRDge9BW0blQvyIWeaPZUjpq CehhqW25molXb72kuGuyIhm7fNEiY2Cm4IfCYdxLIRMeQMfnPPHORYMuhbqJriAywh+KQHV5yXx QDtOGyQ3yLLiP9q/xopEgd/lALZgam8YeJ8VwTRFPoZyn7baPkGt6FaOs1980yua2KzsfPIjam/ r7lcLIYgIsS1/XEXYv/JuaZUK5GCoMDFENHAecJa/gl9lzoy X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_123331_111637_BBBC610B X-CRM114-Status: GOOD ( 16.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/pci/controller/cadence/pci-j721e.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c index cc83a8925ce0..e70213c9060a 100644 --- a/drivers/pci/controller/cadence/pci-j721e.c +++ b/drivers/pci/controller/cadence/pci-j721e.c @@ -542,7 +542,7 @@ static int j721e_pcie_probe(struct platform_device *pdev) return ret; } -static int j721e_pcie_remove(struct platform_device *pdev) +static void j721e_pcie_remove(struct platform_device *pdev) { struct j721e_pcie *pcie = platform_get_drvdata(pdev); struct cdns_pcie *cdns_pcie = pcie->cdns_pcie; @@ -552,13 +552,11 @@ static int j721e_pcie_remove(struct platform_device *pdev) cdns_pcie_disable_phy(cdns_pcie); pm_runtime_put(dev); pm_runtime_disable(dev); - - return 0; } static struct platform_driver j721e_pcie_driver = { .probe = j721e_pcie_probe, - .remove = j721e_pcie_remove, + .remove_new = j721e_pcie_remove, .driver = { .name = "j721e-pcie", .of_match_table = of_j721e_pcie_match, From patchwork Tue Mar 21 19:32:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13183163 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B8105C76195 for ; Tue, 21 Mar 2023 19:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HIFDkDNLhaJp4H08Yk6it+YMfHLvqLPIkKf38TYrP+A=; b=cf1EPJvNVsBaiU 2+uuMjF3/KElVAy2sa7ZrBFXhg7oHRRWw11uDVyu9zVEXKV3SP6i4Z6p30hK4BzmXoL9gqSFSeltZ I0NtzKJstTRqbxTdlZs9wFEuZC47K2vibZUTXuaRvbmPnA2T5pEhanyBaZ8dpjLeCPlkw1JXstqXH f2nHaPtmTQMgk6LpW26EZdIKIJEXLMNKtNMY6XIREqzUWU6uf/3iUuiB4vUfHtZoLXjgMsIJ3I6gd nEHjyztq9cn4AD5dXP8jkBSs7K1LAGUI8urEbSuifAzsW+B3EnvhVL2FUTdU70pjWenWQ2VTQRSm3 lSqFNtRLSdud4xbrudpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pehip-00DUmP-1u; Tue, 21 Mar 2023 19:32:39 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pehii-00DUe2-0Q for linux-arm-kernel@lists.infradead.org; Tue, 21 Mar 2023 19:32:34 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pehiW-0008ES-GI; Tue, 21 Mar 2023 20:32:20 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pehiV-005l6F-P1; Tue, 21 Mar 2023 20:32:19 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pehiU-006qy7-U2; Tue, 21 Mar 2023 20:32:18 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Ray Jui , Scott Branden Cc: Rob Herring , Broadcom internal kernel review list , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 08/15] PCI: iproc: Convert to platform remove callback returning void Date: Tue, 21 Mar 2023 20:32:01 +0100 Message-Id: <20230321193208.366561-9-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> References: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3129; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=AbjymvMRf/21gg3dFf/LJ8mfhoO6t0bYbQgCjssNDSk=; b=owGbwMvMwMXY3/A7olbonx/jabUkhhQpNpHvWeEJset99E+8+2IS+tpO+pabyJXpRjcypuwz8 W1ZGxXWyWjMwsDIxSArpshi37gm06pKLrJz7b/LMINYmUCmMHBxCsBE2lrY/2dPiDRem+DXEapf MSVYlfm9g/Ji4VeFkXalyudncFQ35/5N/a9UufLTs9cWIQtMlfRtTyTwK8oLTzu44d2Hg395Pe6 GegWte/bd63SBe/tew3s+lb4uz3Y/kxEKtlrUtKR/M49c+gKDHmYriwrTK6bnFA/VFk+zN7wbE8 TqeeNWle4/B763l0POBD6aamit6ReS9sXOXeakKl/kvi/xL/xnLQ3jFt2qUqz3vmHOpZKK0LKGI iXVu4L7fv7xc5batG7eNDmjb9dPv7KZoxydeXdlwfMbm7dN+WL/4G/i/ZZ+rfidQiFdxkoRgSuP bNR+NFFeOlJlW/H+Xe9rPCelu+y152KN+qFVHJzO8lsCAA== X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_123232_285088_3783CCA7 X-CRM114-Status: GOOD ( 17.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. The iproc driver always returns 0, it's just a bit hidden. So make iproc_pcie_remove() return void instead of always zero and convert the platform driver to the alternative remove callback that returns void and eventually replaces the int returning callback. Signed-off-by: Uwe Kleine-König Acked-by: Florian Fainelli --- drivers/pci/controller/pcie-iproc-platform.c | 6 +++--- drivers/pci/controller/pcie-iproc.c | 4 +--- drivers/pci/controller/pcie-iproc.h | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/pcie-iproc-platform.c b/drivers/pci/controller/pcie-iproc-platform.c index 4142a73e611d..acdc583d2980 100644 --- a/drivers/pci/controller/pcie-iproc-platform.c +++ b/drivers/pci/controller/pcie-iproc-platform.c @@ -114,11 +114,11 @@ static int iproc_pltfm_pcie_probe(struct platform_device *pdev) return 0; } -static int iproc_pltfm_pcie_remove(struct platform_device *pdev) +static void iproc_pltfm_pcie_remove(struct platform_device *pdev) { struct iproc_pcie *pcie = platform_get_drvdata(pdev); - return iproc_pcie_remove(pcie); + iproc_pcie_remove(pcie); } static void iproc_pltfm_pcie_shutdown(struct platform_device *pdev) @@ -134,7 +134,7 @@ static struct platform_driver iproc_pltfm_pcie_driver = { .of_match_table = of_match_ptr(iproc_pcie_of_match_table), }, .probe = iproc_pltfm_pcie_probe, - .remove = iproc_pltfm_pcie_remove, + .remove_new = iproc_pltfm_pcie_remove, .shutdown = iproc_pltfm_pcie_shutdown, }; module_platform_driver(iproc_pltfm_pcie_driver); diff --git a/drivers/pci/controller/pcie-iproc.c b/drivers/pci/controller/pcie-iproc.c index 83029bdfd884..bd1c98b68851 100644 --- a/drivers/pci/controller/pcie-iproc.c +++ b/drivers/pci/controller/pcie-iproc.c @@ -1537,7 +1537,7 @@ int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res) } EXPORT_SYMBOL(iproc_pcie_setup); -int iproc_pcie_remove(struct iproc_pcie *pcie) +void iproc_pcie_remove(struct iproc_pcie *pcie) { struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie); @@ -1548,8 +1548,6 @@ int iproc_pcie_remove(struct iproc_pcie *pcie) phy_power_off(pcie->phy); phy_exit(pcie->phy); - - return 0; } EXPORT_SYMBOL(iproc_pcie_remove); diff --git a/drivers/pci/controller/pcie-iproc.h b/drivers/pci/controller/pcie-iproc.h index dcca315897c8..969ded03b8c2 100644 --- a/drivers/pci/controller/pcie-iproc.h +++ b/drivers/pci/controller/pcie-iproc.h @@ -111,7 +111,7 @@ struct iproc_pcie { }; int iproc_pcie_setup(struct iproc_pcie *pcie, struct list_head *res); -int iproc_pcie_remove(struct iproc_pcie *pcie); +void iproc_pcie_remove(struct iproc_pcie *pcie); int iproc_pcie_shutdown(struct iproc_pcie *pcie); #ifdef CONFIG_PCIE_IPROC_MSI From patchwork Tue Mar 21 19:32:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13183167 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9BD39C6FD20 for ; Tue, 21 Mar 2023 19:34:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=25Bm1F2R8XNwyXQkVP3iwQqa7KivOMr4YCVBa9FOt6Y=; b=f4Id83lCWj/4mv mfPVhQ3j2tTEgwl6N4ZH9YIqENBOtW14OKE/vlOypNElPehWsM1jzYqdNIz21A/4QCjppbkzHrB6a aRtl62MauenSw73048mw8yeJodh8e82of3qcB2+97OcZf5/ZfbCf8PY6LBW0F13Yr/SdInr6iiyns V38tLKQPOd4Bm3IQvEhR2PvDFd47JCxNMBaPcA/IGgshezHOaAGNXXZhPxWFNl+cL1+zEHvBdGVCs dSRI+PedVV1cDNIqZe93QYxML08B0h0wlIDppO5cataW43Mz931jSwvxMkdpSKWDI+jAgrSTh8k5z txRmU8LJKvvP5QVOI4EQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pehja-00DVBE-1e; Tue, 21 Mar 2023 19:33:26 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pehin-00DUkE-0a for linux-arm-kernel@lists.infradead.org; Tue, 21 Mar 2023 19:32:38 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pehiX-0008Fj-Pz; Tue, 21 Mar 2023 20:32:21 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pehiW-005l6N-Ap; Tue, 21 Mar 2023 20:32:20 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pehiV-006qyD-4e; Tue, 21 Mar 2023 20:32:19 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Ryder Lee , Jianjun Wang , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Bjorn Helgaas , Matthias Brugger Cc: Rob Herring , AngeloGioacchino Del Regno , linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org Subject: [PATCH 09/15] PCI: mediatek: Convert to platform remove callback returning void Date: Tue, 21 Mar 2023 20:32:02 +0100 Message-Id: <20230321193208.366561-10-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> References: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1861; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=BqTXbQjpydZd0O5aTX5s2W2EZwwLHi0+7AG52hoX150=; b=owGbwMvMwMXY3/A7olbonx/jabUkhhQpNlGGjOmvjdSlNeu/xc9tVYh2WVPy/73zjXw5rfiNe ZJ35b90MhqzMDByMciKKbLYN67JtKqSi+xc++8yzCBWJrApXJwCMBHZv+z//Taq3FVxK+pl/s2y ia1+7fM+X1bHXebLo+3Zi9duUhG3D0w+uKpcOLfDUST4/bcPF45MSJtpfitqqneb2VP++4u23hF 8Ncv4t5Bf0nXPtgmvgq7qKm32Y7CvvsPlcyK9YnN/5ktFM80XRxLmH+FsYzTs+9/18eXGJ+ot3I 75h6ddtCs75/FOcu7keTWVqhfXlSY+6hfOllUPP7LLP1n85N490/2e7V7uHSZuKjL5VvRVvz+XE zU3Oez/dX/TohUHr5ax+uqWb365+ve0E/bNKz3Z2JSMTHp2/niWfLE0P9lrV0GaSGBdjMvCawZ6 cn/6HB5K+rl27xZexneysPfR2S/5JytVEzwO+ObYdJoBAA== X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_123237_268489_3DEFD565 X-CRM114-Status: GOOD ( 16.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/pci/controller/pcie-mediatek.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c index ae5ad05ddc1d..7ee03400961b 100644 --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -1134,7 +1134,7 @@ static void mtk_pcie_free_resources(struct mtk_pcie *pcie) pci_free_resource_list(windows); } -static int mtk_pcie_remove(struct platform_device *pdev) +static void mtk_pcie_remove(struct platform_device *pdev) { struct mtk_pcie *pcie = platform_get_drvdata(pdev); struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie); @@ -1146,8 +1146,6 @@ static int mtk_pcie_remove(struct platform_device *pdev) mtk_pcie_irq_teardown(pcie); mtk_pcie_put_resources(pcie); - - return 0; } static int mtk_pcie_suspend_noirq(struct device *dev) @@ -1239,7 +1237,7 @@ MODULE_DEVICE_TABLE(of, mtk_pcie_ids); static struct platform_driver mtk_pcie_driver = { .probe = mtk_pcie_probe, - .remove = mtk_pcie_remove, + .remove_new = mtk_pcie_remove, .driver = { .name = "mtk-pcie", .of_match_table = mtk_pcie_ids, From patchwork Tue Mar 21 19:32:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13183169 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 090A0C6FD20 for ; Tue, 21 Mar 2023 19:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GEGOODwQCrS3T0W2/GdclwndjtGnmfaQpGaTe9C832o=; b=xApu31BM88JmOK Td5QZPnTrr3cDg3d3pMh5bwZQOsVazgR2iToYnWLnNqDkK7mktQ3nKBnQt9OTHEgMOGxgoOS+l7d1 joDBC2V6WhWEKo5pyT4+HAil2odTjPv3NdBNMvVWsidGoW0QiWPizE5uty5cmWoQrz9NnZRBfwM9v qaCOiuEKAJPqlm0Vl1qVih5hdUyzEatIeHoMUSF6NAPbxgWL3hmgSc5idZCKUhKP22H7SoBCTGRmv CbZWIN7duqebKuj6j3jKIZp0XXWzhYtJXIc7vg+vJaj2qZxPeL9o9Jv3Qt56vTjLG0UPmDNfRKuG1 k+0I3NzhKjrU9WmUgNhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pehjd-00DVCv-0A; Tue, 21 Mar 2023 19:33:29 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pehin-00DUkF-15 for linux-arm-kernel@lists.infradead.org; Tue, 21 Mar 2023 19:32:39 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pehiX-0008Eh-Q0; Tue, 21 Mar 2023 20:32:21 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pehiV-005l6I-VP; Tue, 21 Mar 2023 20:32:19 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pehiV-006qyG-Bc; Tue, 21 Mar 2023 20:32:19 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Ryder Lee , Jianjun Wang , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Bjorn Helgaas , Matthias Brugger Cc: Rob Herring , AngeloGioacchino Del Regno , linux-pci@vger.kernel.org, linux-mediatek@lists.infradead.org, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org Subject: [PATCH 10/15] PCI: mediatek-gen3: Convert to platform remove callback returning void Date: Tue, 21 Mar 2023 20:32:03 +0100 Message-Id: <20230321193208.366561-11-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> References: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1877; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=dm2KOnBfcDXLhSk/3xfJfQ1wwRbtFrvgg8+uKO1zBcs=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkGgYWaKJghlqrsHyZT29xkKwu5zIx0+OO7x5E4 Jnn5kss8P2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZBoGFgAKCRCPgPtYfRL+ TsNqB/987bxfqmj7a9c2abs3SkeXq+XtDfRUVuHxPvwMkSuSd/L5R8raZ5Qwd25L6AVnXn1cdqT 9L/QmSLfi7wK/eVuJxJFNVhCHSEyD7dYVJCAdGm8QYpo3tT9LSm5tJ5mAPRqvxadkoK90gZMdwl z1Bq7byTiMSc98ZluH7ldc9JonWrZMZUTN7+fGGNN1GmoxYVNQA4QTs8WuiKPKybnYpFf+njpVf Ixzogqb6bouEnMo0Gy6bRWXD037BvLtzIOffHXfPuJgzuM5UZgME8a57yIWZWJWv77o2MxmyfqU doKcPSh7m05FaFjPwGCzyP0MGNlIspbVvHx/NfgYAcmPMOIU X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_123237_401409_8B64133E X-CRM114-Status: GOOD ( 16.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/pci/controller/pcie-mediatek-gen3.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/controller/pcie-mediatek-gen3.c index b8612ce5f4d0..e0e27645fdf4 100644 --- a/drivers/pci/controller/pcie-mediatek-gen3.c +++ b/drivers/pci/controller/pcie-mediatek-gen3.c @@ -943,7 +943,7 @@ static int mtk_pcie_probe(struct platform_device *pdev) return 0; } -static int mtk_pcie_remove(struct platform_device *pdev) +static void mtk_pcie_remove(struct platform_device *pdev) { struct mtk_gen3_pcie *pcie = platform_get_drvdata(pdev); struct pci_host_bridge *host = pci_host_bridge_from_priv(pcie); @@ -955,8 +955,6 @@ static int mtk_pcie_remove(struct platform_device *pdev) mtk_pcie_irq_teardown(pcie); mtk_pcie_power_down(pcie); - - return 0; } static void mtk_pcie_irq_save(struct mtk_gen3_pcie *pcie) @@ -1069,7 +1067,7 @@ MODULE_DEVICE_TABLE(of, mtk_pcie_of_match); static struct platform_driver mtk_pcie_driver = { .probe = mtk_pcie_probe, - .remove = mtk_pcie_remove, + .remove_new = mtk_pcie_remove, .driver = { .name = "mtk-pcie-gen3", .of_match_table = mtk_pcie_of_match, From patchwork Tue Mar 21 19:32:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13183161 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B57B9C6FD1D for ; Tue, 21 Mar 2023 19:34:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KI6Q4iPFcGuMU898+k1FxvlS7EZmqQsc/+p8/lhXmKg=; b=u6x8dhvG8Cwro1 gjfBBBRH1HT855J6klfKOtIby6STwxwodabxTHkIFpcxTitq0SZIRGMsPM4MEZljPEmm/MHxB9qrA JzDbveTA1j/T1rjBclndPuwW8t4cFd5wAZOZ6p5sJL33vbjnzij/9iGpyrYgskiWkF5jRrp0uKJWS gLJeKK/NfcxI0ksmWrIFVUpuW3NFTj3WWzV6vkHo9uwgwxD+qSPGfgN8RyIrKMtFQQZOrFNPM5qgx SUt3oF2vt4Tnl+qoT57TEaJktY2Im0yLs6p9DAG4YOgvWFTZ7iuIpVOSolTrQNyy3PiMzQZ/ebkGm ev8LDDMktPPGQ7efHgrQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pehil-00DUjM-1b; Tue, 21 Mar 2023 19:32:35 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pehii-00DUeJ-0Q for linux-arm-kernel@lists.infradead.org; Tue, 21 Mar 2023 19:32:33 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pehiX-0008GA-Px; Tue, 21 Mar 2023 20:32:21 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pehiW-005l6S-KJ; Tue, 21 Mar 2023 20:32:20 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pehiV-006qyK-MY; Tue, 21 Mar 2023 20:32:19 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Sergio Paracuellos , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Bjorn Helgaas , Matthias Brugger Cc: Rob Herring , AngeloGioacchino Del Regno , linux-pci@vger.kernel.org, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 11/15] PCI: mt7621: Convert to platform remove callback returning void Date: Tue, 21 Mar 2023 20:32:04 +0100 Message-Id: <20230321193208.366561-12-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> References: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1768; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=XIs1m3pob3y8U3JDqdDB0F399dkIu3Xz7ps7Nn8DeQo=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkGgYXsgcJ2ulde0UGwO1bCPx5jrsNrNECByn/+ JqPq845BOqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZBoGFwAKCRCPgPtYfRL+ TqqMB/9ISFGGASsk4hij7f9GVng8JBFLx4hkxt8tP3dVXtzaEpJsrW43rj+GMIzWNujRUPUAk5d uxGzbOYhPOTduIaZ/55aj1K4+LZlaVIxkENJfukq0K/93WfUjxXTsR32lgf8fM/iJR1FQ2xhoGD Hk5R/h3+3tg5Rk0UeREiYjSnJovr70hHnFX4FjpGO6fX7yFkqABZ5gA4ZMHzpJUtcdsJhJNM+dU GTHRzKcrk4LwqBWK9XkV7SkPme9GwzjbVa/a4vLg4cR5oGiqNPEQOeAbsZL6YEqp6J10On3J6tg Hv8rVdRa1MVU+sGvGGIPPWSIW+4JbWTob5/KCrLGVbYbs9pu X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_123232_181678_145562B9 X-CRM114-Status: GOOD ( 16.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König Reviewed-by: Sergio Paracuellos --- drivers/pci/controller/pcie-mt7621.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pcie-mt7621.c b/drivers/pci/controller/pcie-mt7621.c index 63a5f4463a9f..a6df50a945d1 100644 --- a/drivers/pci/controller/pcie-mt7621.c +++ b/drivers/pci/controller/pcie-mt7621.c @@ -524,15 +524,13 @@ static int mt7621_pcie_probe(struct platform_device *pdev) return err; } -static int mt7621_pcie_remove(struct platform_device *pdev) +static void mt7621_pcie_remove(struct platform_device *pdev) { struct mt7621_pcie *pcie = platform_get_drvdata(pdev); struct mt7621_pcie_port *port; list_for_each_entry(port, &pcie->ports, list) reset_control_put(port->pcie_rst); - - return 0; } static const struct of_device_id mt7621_pcie_ids[] = { @@ -543,7 +541,7 @@ MODULE_DEVICE_TABLE(of, mt7621_pcie_ids); static struct platform_driver mt7621_pcie_driver = { .probe = mt7621_pcie_probe, - .remove = mt7621_pcie_remove, + .remove_new = mt7621_pcie_remove, .driver = { .name = "mt7621-pci", .of_match_table = mt7621_pcie_ids, From patchwork Tue Mar 21 19:32:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13183164 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B2810C6FD20 for ; Tue, 21 Mar 2023 19:34:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=31gMPyEpe8ibB2iHr/eUoaLBrcMRC6uDBiG1qfYR1pQ=; b=lLBNU/b3aISdvy w1XV30dssdbiZx1ruXctfO2l3/7nZIXMWiVUSJ2JskZmKf5ZK4Oxy6pYCd6tcCIXWV/PHWQ0kO9/0 rIMz2zeqZOn24G9P6rHMuerh8MXawXhHLtnPANmRWTaHhgYqqDcpetliaYkbc9uaIaj1hsj2q56ZS LQ6rDdPiay9BWv+ouGPWaAqeuKQxVkklKn7mDPwuIA0A7Z+DOW15BlYA7EuUp3CcUKc8yBOS/NnFk KdGjGp4ZljMPo4X7rROQPTiK6LpWrUpfABE1vZbFenoBnvn+S6rXIUr95Yfr5YAFKcglpbhyLiw4d 3azuI2c8CQTxfJvjXviw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pehjL-00DUzp-1H; Tue, 21 Mar 2023 19:33:11 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pehii-00DUfI-0Q for linux-arm-kernel@lists.infradead.org; Tue, 21 Mar 2023 19:32:34 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pehiX-0008Gf-LH; Tue, 21 Mar 2023 20:32:21 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pehiW-005l6b-V4; Tue, 21 Mar 2023 20:32:20 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pehiW-006qyP-6n; Tue, 21 Mar 2023 20:32:20 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Thomas Petazzoni , =?utf-8?q?Pali_Roh?= =?utf-8?q?=C3=A1r?= , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Bjorn Helgaas Cc: Rob Herring , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 12/15] PCI: mvebu: Convert to platform remove callback returning void Date: Tue, 21 Mar 2023 20:32:05 +0100 Message-Id: <20230321193208.366561-13-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> References: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1875; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=s0X5jS6+nTnWbE2Dk9p3FoHJJcKJGi4IsaWIYZ59Q1g=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkGgYY6yf23C8VzXDT/4rOJJFfQ6NkyWENC99WL /tsrXR9FOaJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZBoGGAAKCRCPgPtYfRL+ TnCLCACqYRUTp6nMdhZfhXPXumhOHfgBi/T7IOe0kAJ0yRsfWnUCNqR+sR5BLawbQzU3dKrvPhX PFjgfU6JMkJNVZ1yMgmFVT5ZbDOoIPnV56t1Yk+eK6wIYTAQS+S3Ycet+5MLK+KpJrvCmrVCDUj YkGO06e+rYkdTFotAO4CieIhPpHadGyjxSr6HPz5DjESWd/C12Nb5C7ewKfFmHYWa9B29YOCdc8 dC/fysqaP0IXdVa/p6DrFwg+ce2jjw1sk1a3vab8WxsgDOENHoXaD+3kHyfY9KeT6VC6eUPW3vA lOZ4WOHPpMQDScM5QMSGSVVGEbXVqniHmHNXlTeKFELQhWsv X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_123232_294370_527F337D X-CRM114-Status: GOOD ( 16.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/pci/controller/pci-mvebu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c index 1dc209f6f53a..c931b1b07b1d 100644 --- a/drivers/pci/controller/pci-mvebu.c +++ b/drivers/pci/controller/pci-mvebu.c @@ -1649,7 +1649,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev) return pci_host_probe(bridge); } -static int mvebu_pcie_remove(struct platform_device *pdev) +static void mvebu_pcie_remove(struct platform_device *pdev) { struct mvebu_pcie *pcie = platform_get_drvdata(pdev); struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); @@ -1707,8 +1707,6 @@ static int mvebu_pcie_remove(struct platform_device *pdev) /* Power down card and disable clocks. Must be the last step. */ mvebu_pcie_powerdown(port); } - - return 0; } static const struct of_device_id mvebu_pcie_of_match_table[] = { @@ -1730,7 +1728,7 @@ static struct platform_driver mvebu_pcie_driver = { .pm = &mvebu_pcie_pm_ops, }, .probe = mvebu_pcie_probe, - .remove = mvebu_pcie_remove, + .remove_new = mvebu_pcie_remove, }; module_platform_driver(mvebu_pcie_driver); From patchwork Tue Mar 21 19:32:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13183168 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5F38FC76195 for ; Tue, 21 Mar 2023 19:34:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bIsUwGhc+HZ5fFsJ+filUR4Vs2+GDpeULxVrxkinm+4=; b=tIeOnQ0XG+n47L P+OUmMVyFhCBYdFZTR252JQXeRdHorMtz7sHMQ8qs9jYs5eBdZGcV5et3fltup2mZzrSKLZOUR19Z MadWdNlhztd6cr9nxqfj39cq9RBDp8LoJo5D2/cZnqa2Jg/Iqv1fqzXRX8xxrXySvwyedhDUBSQbP Gne2eYDGPaD3AvFEccr/tyGsjE1d3AMuzxqoXBao8VdL5tvGi7iA8ZJLVrxFVenXAlznZ+DWrBDe8 EPne50uPuCVXjXU6GyQaIpGFp4EyVQgkW7d7HER7EOcWPjdVwPG5YsoIaPCSBodS23q/ThbWNpgxc B41uJAHLnbSsfzvSOFXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pehjU-00DV70-2j; Tue, 21 Mar 2023 19:33:20 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pehin-00DUkD-0N for linux-arm-kernel@lists.infradead.org; Tue, 21 Mar 2023 19:32:38 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pehiZ-0008H0-Li; Tue, 21 Mar 2023 20:32:23 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pehiX-005l6g-9d; Tue, 21 Mar 2023 20:32:21 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pehiW-006qyT-H9; Tue, 21 Mar 2023 20:32:20 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Shawn Lin , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Bjorn Helgaas , Heiko Stuebner Cc: Rob Herring , linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 13/15] PCI: rockchip-host: Convert to platform remove callback returning void Date: Tue, 21 Mar 2023 20:32:06 +0100 Message-Id: <20230321193208.366561-14-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> References: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1911; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=ofg5jFyTz9TdBxGAvLkoTuHqV4U6+M5kLCVHC2oN85w=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkGgYaEVenR+PbZmv1vqyaQaldvtjlCJf2NK7Xb RzAKqhDjLiJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZBoGGgAKCRCPgPtYfRL+ To+OB/9fjegMCZsidNokCfKIS2VY0NiiY64ungPOLTfd4v+zmDT8anQS2ZlnmQuywnWUBiyM2ci MwGV2W8/hjaRK4VxmreBZBm2lGRhAKS11SqwkmKojJTTxSHJirKrBDtu6tg/IlcBS6dOgboFG81 qkLTxU0KZAdC23KCxQSluDJQfkVq/h3nuwRgSIejPDe5te/p9f2iH4spXS/fWWeU1YK7Up+liLp UGGiDWgK2Np2MZ0x8DGnNi/Z69xN4zP/D65UFRAvCHPbKnjpdGP1kiULJHbzXyRHLzfbrN+50+V 9k5vXDKt/Ol4Sh+R8eolaLfWP9XZvi1GyHI5dkmBWJvU04BR X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_123237_160442_097B84A2 X-CRM114-Status: GOOD ( 16.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/pci/controller/pcie-rockchip-host.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c index c96c0f454570..2438bc9b3a1a 100644 --- a/drivers/pci/controller/pcie-rockchip-host.c +++ b/drivers/pci/controller/pcie-rockchip-host.c @@ -1009,7 +1009,7 @@ static int rockchip_pcie_probe(struct platform_device *pdev) return err; } -static int rockchip_pcie_remove(struct platform_device *pdev) +static void rockchip_pcie_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct rockchip_pcie *rockchip = dev_get_drvdata(dev); @@ -1029,8 +1029,6 @@ static int rockchip_pcie_remove(struct platform_device *pdev) regulator_disable(rockchip->vpcie3v3); regulator_disable(rockchip->vpcie1v8); regulator_disable(rockchip->vpcie0v9); - - return 0; } static const struct dev_pm_ops rockchip_pcie_pm_ops = { @@ -1051,7 +1049,7 @@ static struct platform_driver rockchip_pcie_driver = { .pm = &rockchip_pcie_pm_ops, }, .probe = rockchip_pcie_probe, - .remove = rockchip_pcie_remove, + .remove_new = rockchip_pcie_remove, }; module_platform_driver(rockchip_pcie_driver); From patchwork Tue Mar 21 19:32:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13183165 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E40FC6FD1D for ; Tue, 21 Mar 2023 19:34:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=K4F9bTHi0j3VScHq+bBql7EEWYlU2k+JWTxbx0dWs/o=; b=4aD1vJk3AF4CDu 4577zVgXMtam4z+2BYnUDlOpQykTPMPNh64InlE4+RTd0yTVkWqRsy4OIEVfAi9YEv0aZM6EW0P/W J/uD4ovWoRpXfuMiTIDnkUeXQtJtc19oKJZ1p7gMrgPNTgk8FeroUMJMgSg8s1ro+ZtZyj3RXj8Ko 8J0ahdLZZaSLW4tCTTTNjRYsdTH6uf/nauieNosLVAzkfnKs+KQ4QI0CFkcz/yvp32KIaHB47zs0J 19pbsJf5LWQAy9lWFmXX2dp8hhtMBNzw4TpRJpqXhV8Iwk6ztpcDUR6gKsGq2zzg6hmqU3O9VkbTs 8E7ntRShW1+bj6B8V1lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pehjN-00DV0s-0O; Tue, 21 Mar 2023 19:33:13 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pehii-00DUei-0Q for linux-arm-kernel@lists.infradead.org; Tue, 21 Mar 2023 19:32:35 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pehiZ-0008JI-8m; Tue, 21 Mar 2023 20:32:23 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pehiY-005l6r-HO; Tue, 21 Mar 2023 20:32:22 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pehiW-006qya-WD; Tue, 21 Mar 2023 20:32:21 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Toan Le , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Bjorn Helgaas Cc: Rob Herring , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 15/15] PCI: xgene-msi: Convert to platform remove callback returning void Date: Tue, 21 Mar 2023 20:32:08 +0100 Message-Id: <20230321193208.366561-16-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> References: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1764; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=g4mawOD/hBAIs+EkcP3CuSa/TPVhhAT1rILcKdZNAkA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkGgYcWPE7Y/ad4xZdZSWD/ZWyuqJ5nsaeZwjS+ N3udKv7GH2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZBoGHAAKCRCPgPtYfRL+ TnbIB/wNJy4Gp6R+qf4fCOZwbT+ibDo1HK35x46t90OiBBVxs0xPFsvTfQpgvhITYlEFwd9z3a2 huu5z5R4GkLuGXBVgUds2KrFNAnUAXj2UbLxGmCfsVwxT2hbRpJlM2H1kVDYfk09uu9D6C/bTSD +rrnqLnqW2quPlXQ0iv/kVRrlquHIeFJYXzmr660UODMYf3nNMFcLhP9WgF2S+YwHvuA7+lzpS3 mKbWSK5SoMgJWjXjXdykc4PeO9y5Voh7cBK+Rk6qwqd4WInaFPG0pJqAOwAbK8rvT6ibpckUUMI /m/Tt65Rr6g8h7mxdoUrw3luStocaElGrUnEVZ9woZqPLElJ X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230321_123232_296773_F44EDA75 X-CRM114-Status: GOOD ( 16.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/pci/controller/pci-xgene-msi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/pci-xgene-msi.c b/drivers/pci/controller/pci-xgene-msi.c index d7987b281f79..0234e528b9a5 100644 --- a/drivers/pci/controller/pci-xgene-msi.c +++ b/drivers/pci/controller/pci-xgene-msi.c @@ -348,7 +348,7 @@ static void xgene_msi_isr(struct irq_desc *desc) static enum cpuhp_state pci_xgene_online; -static int xgene_msi_remove(struct platform_device *pdev) +static void xgene_msi_remove(struct platform_device *pdev) { struct xgene_msi *msi = platform_get_drvdata(pdev); @@ -362,8 +362,6 @@ static int xgene_msi_remove(struct platform_device *pdev) msi->bitmap = NULL; xgene_free_domains(msi); - - return 0; } static int xgene_msi_hwirq_alloc(unsigned int cpu) @@ -521,7 +519,7 @@ static struct platform_driver xgene_msi_driver = { .of_match_table = xgene_msi_match_table, }, .probe = xgene_msi_probe, - .remove = xgene_msi_remove, + .remove_new = xgene_msi_remove, }; static int __init xgene_pcie_msi_init(void)