From patchwork Tue Jun 6 16:28:22 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: 13269452 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D40233C9B for ; Tue, 6 Jun 2023 16:28:46 +0000 (UTC) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED113FB for ; Tue, 6 Jun 2023 09:28:44 -0700 (PDT) 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 1q6ZXv-00056h-AK; Tue, 06 Jun 2023 18:28:35 +0200 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 1q6ZXt-005Y5Q-VP; Tue, 06 Jun 2023 18:28:33 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q6ZXt-00Bl0K-3d; Tue, 06 Jun 2023 18:28:33 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Madalin Bucur , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King Cc: netdev@vger.kernel.org, kernel@pengutronix.de, Madalin Bucur , Michal Kubiak Subject: [PATCH net-next v2 1/8] net: dpaa: Improve error reporting Date: Tue, 6 Jun 2023 18:28:22 +0200 Message-Id: <20230606162829.166226-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> References: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1560; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=KPuBxR8yI1nN/gV8dadKWqbIlvPQ36Amsh9ydxKH2Do=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkf16ijykIjfdq52lnM9BFPHAv4FsQEt5TPBzaa 96Sev1A/QqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZH9eogAKCRCPgPtYfRL+ TmWjB/97ifj+75gt3JkJ59rYnNcVUdrB7TkCNndUHhIianACcQe1t1CfuS3ubvD5Lc4PQoZ2YVs ODuF375vq5NX8Tj5Qn+HgyhC+5ED/4OzR+lv08D7ryMISaC+u5zoWMCvGncyteU321vjgu6ZBqc oAST/irZutForOl34afZl3XHDq3tFKYGvLflP1Jq4s7gWAXmHlcS1gygxW6poEJzKiuMCztig1p sEWV56XSdk+UkQCEqCAKwytkhTy0c4vu8R+2uERpk7+ZOBBxXakdXSF/WxSVcFvQrhL/tN999Fo owAIEAD4ekPGkVoCsg8Eo19FMSkV2MMcb7sXFetzCZ7NyxeZ 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: netdev@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org Instead of the generic error message emitted by the driver core when a remove callback returns an error code ("remove callback returned a non-zero value. This will be ignored."), emit a message describing the actual problem and return zero to suppress the generic message. Note that apart from suppressing the generic error message there are no side effects by changing the return value to zero. This prepares changing the remove callback to return void. Acked-by: Madalin Bucur Reviewed-by: Michal Kubiak Signed-off-by: Uwe Kleine-König --- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 431f8917dc39..6226c03cfca0 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -3516,6 +3516,8 @@ static int dpaa_remove(struct platform_device *pdev) phylink_destroy(priv->mac_dev->phylink); err = dpaa_fq_free(dev, &priv->dpaa_fq_list); + if (err) + dev_err(dev, "Failed to free FQs on remove\n"); qman_delete_cgr_safe(&priv->ingress_cgr); qman_release_cgrid(priv->ingress_cgr.cgrid); @@ -3528,7 +3530,7 @@ static int dpaa_remove(struct platform_device *pdev) free_netdev(net_dev); - return err; + return 0; } static const struct platform_device_id dpaa_devtype[] = { From patchwork Tue Jun 6 16:28:23 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: 13269451 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3786433C88 for ; Tue, 6 Jun 2023 16:28:46 +0000 (UTC) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8989E60 for ; Tue, 6 Jun 2023 09:28:44 -0700 (PDT) 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 1q6ZXv-00056i-AK; Tue, 06 Jun 2023 18:28:35 +0200 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 1q6ZXu-005Y5U-3c; Tue, 06 Jun 2023 18:28:34 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q6ZXt-00Bl0N-Ab; Tue, 06 Jun 2023 18:28:33 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Madalin Bucur , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, kernel@pengutronix.de, Madalin Bucur , Michal Kubiak Subject: [PATCH net-next v2 2/8] net: dpaa: Convert to platform remove callback returning void Date: Tue, 6 Jun 2023 18:28:23 +0200 Message-Id: <20230606162829.166226-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> References: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1842; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=B2QTss1d2/RpEoaOO842TWpb2rhQcNCGpvMHcCSocM4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkf16j9aNOGZOarTohH96+PPW7n9j0cy0/2WFjr CaMdX2TpnSJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZH9eowAKCRCPgPtYfRL+ TojNB/wIh9Wn3aGkGSRO0MWfOTIiqviOsbQx53Fx05s5xU/L16rMiDcmKV3OS9ZXyzxzAxx6a9Y fQUqeRxqAmcnCC4ZTOoQoowxbrvW2ctaQn+M2yOrm6J6ywtX6D8us8B9ICephTCw9lpu9jXH8/e Nj22Q+hsee/vVckNPy9DVhQYWY+DACfI/edmOdkdQa5j+ENx+fzjJ6N1wxQtiwoZnMM6xF/pVja DMGycLTNsqu5L10WP4Rk3J5MnA59qIplmsYPqKFSPe5cp0aaK9HiUwetUpbEt0Wko+0FxxjCRPl Q4rSzeUkT0GwZ11CUBneEqn2TbwU5kbcXMYnEibbJ9Jwj0Sb 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: netdev@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.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. Acked-by: Madalin Bucur Reviewed-by: Michal Kubiak Signed-off-by: Uwe Kleine-König Reviewed-by: Simon Horman --- drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index 6226c03cfca0..01c058cd0675 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -3497,7 +3497,7 @@ static int dpaa_eth_probe(struct platform_device *pdev) return err; } -static int dpaa_remove(struct platform_device *pdev) +static void dpaa_remove(struct platform_device *pdev) { struct net_device *net_dev; struct dpaa_priv *priv; @@ -3529,8 +3529,6 @@ static int dpaa_remove(struct platform_device *pdev) dpaa_bps_free(priv); free_netdev(net_dev); - - return 0; } static const struct platform_device_id dpaa_devtype[] = { @@ -3548,7 +3546,7 @@ static struct platform_driver dpaa_driver = { }, .id_table = dpaa_devtype, .probe = dpaa_eth_probe, - .remove = dpaa_remove + .remove_new = dpaa_remove }; static int __init dpaa_load(void) From patchwork Tue Jun 6 16:28:24 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: 13269456 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9472A30B8B for ; Tue, 6 Jun 2023 16:29:03 +0000 (UTC) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32AD5126 for ; Tue, 6 Jun 2023 09:29:02 -0700 (PDT) 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 1q6ZXy-00056j-GU; Tue, 06 Jun 2023 18:28:38 +0200 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 1q6ZXu-005Y5X-5v; Tue, 06 Jun 2023 18:28:34 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q6ZXt-00Bl0Q-Hw; Tue, 06 Jun 2023 18:28:33 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Wei Fang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Marc Kleine-Budde , Damien Le Moal , Michael Ellerman , Andy Shevchenko , Rob Herring Cc: Shenwei Wang , Clark Wang , NXP Linux Team , netdev@vger.kernel.org, kernel@pengutronix.de, Michal Kubiak Subject: [PATCH net-next v2 3/8] net: fec: Convert to platform remove callback returning void Date: Tue, 6 Jun 2023 18:28:24 +0200 Message-Id: <20230606162829.166226-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> References: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3987; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=3JM9bQqrSS0XOrXGmri7S9vrRfS1kXFnP7Nd2N3p5H0=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkf16kyUUhzpUnpv3icW+cx8Qrvm1JVtLjGVjtZ gvPUJnJ4/SJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZH9epAAKCRCPgPtYfRL+ TmfGB/90/SxHI6UJe03AUK3mVop6GRKjYqAIklUDi+BJqVdPBJ7fz1EoGuDlkuSwAPSR4ckTKtN 8l4LiIqfW6WYp/P4fO95Q0vRQMmRoaHESc39QSiRPmMuzR2BAXHC/Kwtzl1RgK0CUTG/lpa2leb nU4lwmzLAaqdWo/7pCy0QHn/5Wq/QWf/X4RY4H/fQm6igPqA0evnGUlWbk4oe2l1po3iCKZM9t1 ElmDe0U1mt8smTAgG8NVxc5SkTLwMtZdirKJlqTWPt6KE49W98Bjbwhejnd6o0Wof76jFYuXYJY UHPoOw0LcClK+aMMU4wEWK7sqnssk5FC2UvL8yvTw++zZ1hF 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: netdev@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.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. Reviewed-by: Michal Kubiak Signed-off-by: Uwe Kleine-König Reviewed-by: Wei Fang Reviewed-by: Simon Horman --- drivers/net/ethernet/freescale/fec_main.c | 5 ++--- drivers/net/ethernet/freescale/fec_mpc52xx.c | 6 ++---- drivers/net/ethernet/freescale/fec_mpc52xx_phy.c | 6 ++---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 632bb4d589d7..f2b333b3f8c5 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -4458,7 +4458,7 @@ fec_probe(struct platform_device *pdev) return ret; } -static int +static void fec_drv_remove(struct platform_device *pdev) { struct net_device *ndev = platform_get_drvdata(pdev); @@ -4494,7 +4494,6 @@ fec_drv_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); free_netdev(ndev); - return 0; } static int __maybe_unused fec_suspend(struct device *dev) @@ -4650,7 +4649,7 @@ static struct platform_driver fec_driver = { }, .id_table = fec_devtype, .probe = fec_probe, - .remove = fec_drv_remove, + .remove_new = fec_drv_remove, }; module_platform_driver(fec_driver); diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c index b88816b71ddf..984ece5cd64f 100644 --- a/drivers/net/ethernet/freescale/fec_mpc52xx.c +++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c @@ -974,7 +974,7 @@ static int mpc52xx_fec_probe(struct platform_device *op) return rv; } -static int +static void mpc52xx_fec_remove(struct platform_device *op) { struct net_device *ndev; @@ -998,8 +998,6 @@ mpc52xx_fec_remove(struct platform_device *op) release_mem_region(ndev->base_addr, sizeof(struct mpc52xx_fec)); free_netdev(ndev); - - return 0; } #ifdef CONFIG_PM @@ -1042,7 +1040,7 @@ static struct platform_driver mpc52xx_fec_driver = { .of_match_table = mpc52xx_fec_match, }, .probe = mpc52xx_fec_probe, - .remove = mpc52xx_fec_remove, + .remove_new = mpc52xx_fec_remove, #ifdef CONFIG_PM .suspend = mpc52xx_fec_of_suspend, .resume = mpc52xx_fec_of_resume, diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx_phy.c b/drivers/net/ethernet/freescale/fec_mpc52xx_phy.c index 95f778cce98c..61d3776d6750 100644 --- a/drivers/net/ethernet/freescale/fec_mpc52xx_phy.c +++ b/drivers/net/ethernet/freescale/fec_mpc52xx_phy.c @@ -117,7 +117,7 @@ static int mpc52xx_fec_mdio_probe(struct platform_device *of) return err; } -static int mpc52xx_fec_mdio_remove(struct platform_device *of) +static void mpc52xx_fec_mdio_remove(struct platform_device *of) { struct mii_bus *bus = platform_get_drvdata(of); struct mpc52xx_fec_mdio_priv *priv = bus->priv; @@ -126,8 +126,6 @@ static int mpc52xx_fec_mdio_remove(struct platform_device *of) iounmap(priv->regs); kfree(priv); mdiobus_free(bus); - - return 0; } static const struct of_device_id mpc52xx_fec_mdio_match[] = { @@ -145,7 +143,7 @@ struct platform_driver mpc52xx_fec_mdio_driver = { .of_match_table = mpc52xx_fec_mdio_match, }, .probe = mpc52xx_fec_mdio_probe, - .remove = mpc52xx_fec_mdio_remove, + .remove_new = mpc52xx_fec_mdio_remove, }; /* let fec driver call it, since this has to be registered before it */ From patchwork Tue Jun 6 16:28:25 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: 13269453 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B60F33C9A for ; Tue, 6 Jun 2023 16:28:46 +0000 (UTC) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D240910C2 for ; Tue, 6 Jun 2023 09:28:44 -0700 (PDT) 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 1q6ZXv-00056k-IV; Tue, 06 Jun 2023 18:28:35 +0200 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 1q6ZXu-005Y5d-Ms; Tue, 06 Jun 2023 18:28:34 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q6ZXt-00Bl0U-P7; Tue, 06 Jun 2023 18:28:33 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Madalin Bucur , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Sean Anderson , netdev@vger.kernel.org, kernel@pengutronix.de, Madalin Bucur , Michal Kubiak Subject: [PATCH net-next v2 4/8] net: fman: Convert to platform remove callback returning void Date: Tue, 6 Jun 2023 18:28:25 +0200 Message-Id: <20230606162829.166226-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> References: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1729; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=9XlZOxPo8x+dfeqL6TZCQg97B+hezbS+e7gfBQATAr4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkf16mCSfJUasQJQjdi63nGVJnfGboftMUteoMo 45Ixqr1/nKJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZH9epgAKCRCPgPtYfRL+ TmB+B/wNgFI3k+QWo0A8icvmrvWIEc/0oG6T+xuJd5x9JDPbIuPr09U6W0hmtM29ANvx7L0eL2T bIT00D8gS06FZeqHJHHwIhBmpSW5afteNdvcPQthhNe+jUmclFSLeqy+XkdUvIHgcrSa57srBT4 qWkuAFgTtxsM9YWpOb24RhUa8ZmtYs+3nRh28QKgeQL6bFURupcgAR9jL+GgTWhaSTodqmkQ5ZQ JXMebOoWeVxzxOq8PKEkpMIPE7Lm3xFdxhcNOvFvK5N568+EMi34xHNMaVCdf8KntglJWd8W7eS 9YPufDU5WZj+HjKJl0sFVe6CtWatQDAn7kP+jktAc32SvlvY 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: netdev@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.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. Acked-by: Madalin Bucur Reviewed-by: Michal Kubiak Signed-off-by: Uwe Kleine-König Reviewed-by: Simon Horman --- drivers/net/ethernet/freescale/fman/mac.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c index 43665806c590..c5045891d694 100644 --- a/drivers/net/ethernet/freescale/fman/mac.c +++ b/drivers/net/ethernet/freescale/fman/mac.c @@ -331,12 +331,11 @@ static int mac_probe(struct platform_device *_of_dev) return err; } -static int mac_remove(struct platform_device *pdev) +static void mac_remove(struct platform_device *pdev) { struct mac_device *mac_dev = platform_get_drvdata(pdev); platform_device_unregister(mac_dev->priv->eth_dev); - return 0; } static struct platform_driver mac_driver = { @@ -345,7 +344,7 @@ static struct platform_driver mac_driver = { .of_match_table = mac_match, }, .probe = mac_probe, - .remove = mac_remove, + .remove_new = mac_remove, }; builtin_platform_driver(mac_driver); From patchwork Tue Jun 6 16:28:26 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: 13269455 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AD59733C9A for ; Tue, 6 Jun 2023 16:28:47 +0000 (UTC) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06F2BE40 for ; Tue, 6 Jun 2023 09:28:46 -0700 (PDT) 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 1q6ZXw-00056l-Bg; Tue, 06 Jun 2023 18:28:36 +0200 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 1q6ZXu-005Y5h-VW; Tue, 06 Jun 2023 18:28:34 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q6ZXt-00Bl0X-Vq; Tue, 06 Jun 2023 18:28:34 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Pantelis Antoniou , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, kernel@pengutronix.de, Michal Kubiak Subject: [PATCH net-next v2 5/8] net: fs_enet: Convert to platform remove callback returning void Date: Tue, 6 Jun 2023 18:28:26 +0200 Message-Id: <20230606162829.166226-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> References: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4371; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=TSxLrItVdGU4w2E+RgCvjB0ueIuADLhsdxN+Ez6quxs=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkf16nfJESMOxvM/9JhX8Nkhsgo+02AlGi6suoS 0Wg+SuWfduJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZH9epwAKCRCPgPtYfRL+ TvtTB/0d/v/kHpcwVLoSwRfgIVeTIdDuj0UbImRVLiuyMx42dp36EQBp7POZpWGpfKklF76nDLS xxvrj9Zr1CjF+unhWz3D3KoXsxy7ubhoNzPpnoS/UyF593IdTgF8/yO+mY37xKxoMtZcg3pq+tN iNfy766ww8IJPz7ff2lkgUUBXZrO7lfT80J6u84lWnr+aEpIBMA95P8n+8iyT0Oiw0ZZYJB5n2o 3BLL3ktL/gb6rpaD89NsatXp8PAQ/HTTYeoSSheSI8SaKBlHEDAfOzp6ok+/hwSpCexXPsQOQx8 x08Tz0NAVM6UZ5YQPU5P8YfQoA8s86NWuWvv0XmyZPm32rj/ 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: netdev@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.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. Reviewed-by: Michal Kubiak Signed-off-by: Uwe Kleine-König Reviewed-by: Simon Horman --- drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 5 ++--- drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | 6 ++---- drivers/net/ethernet/freescale/fs_enet/mii-fec.c | 6 ++---- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c index 8844a9a04fcf..f9f5b28cc72e 100644 --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c @@ -1051,7 +1051,7 @@ static int fs_enet_probe(struct platform_device *ofdev) return ret; } -static int fs_enet_remove(struct platform_device *ofdev) +static void fs_enet_remove(struct platform_device *ofdev) { struct net_device *ndev = platform_get_drvdata(ofdev); struct fs_enet_private *fep = netdev_priv(ndev); @@ -1066,7 +1066,6 @@ static int fs_enet_remove(struct platform_device *ofdev) if (of_phy_is_fixed_link(ofdev->dev.of_node)) of_phy_deregister_fixed_link(ofdev->dev.of_node); free_netdev(ndev); - return 0; } static const struct of_device_id fs_enet_match[] = { @@ -1113,7 +1112,7 @@ static struct platform_driver fs_enet_driver = { .of_match_table = fs_enet_match, }, .probe = fs_enet_probe, - .remove = fs_enet_remove, + .remove_new = fs_enet_remove, }; #ifdef CONFIG_NET_POLL_CONTROLLER diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c index 21de56345503..91a69fc2f7c2 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c +++ b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c @@ -192,7 +192,7 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev) return ret; } -static int fs_enet_mdio_remove(struct platform_device *ofdev) +static void fs_enet_mdio_remove(struct platform_device *ofdev) { struct mii_bus *bus = platform_get_drvdata(ofdev); struct bb_info *bitbang = bus->priv; @@ -201,8 +201,6 @@ static int fs_enet_mdio_remove(struct platform_device *ofdev) free_mdio_bitbang(bus); iounmap(bitbang->dir); kfree(bitbang); - - return 0; } static const struct of_device_id fs_enet_mdio_bb_match[] = { @@ -219,7 +217,7 @@ static struct platform_driver fs_enet_bb_mdio_driver = { .of_match_table = fs_enet_mdio_bb_match, }, .probe = fs_enet_mdio_probe, - .remove = fs_enet_mdio_remove, + .remove_new = fs_enet_mdio_remove, }; module_platform_driver(fs_enet_bb_mdio_driver); diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c index d37d7a19a759..94bd76c6cf9e 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c +++ b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c @@ -187,7 +187,7 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev) return ret; } -static int fs_enet_mdio_remove(struct platform_device *ofdev) +static void fs_enet_mdio_remove(struct platform_device *ofdev) { struct mii_bus *bus = platform_get_drvdata(ofdev); struct fec_info *fec = bus->priv; @@ -196,8 +196,6 @@ static int fs_enet_mdio_remove(struct platform_device *ofdev) iounmap(fec->fecp); kfree(fec); mdiobus_free(bus); - - return 0; } static const struct of_device_id fs_enet_mdio_fec_match[] = { @@ -220,7 +218,7 @@ static struct platform_driver fs_enet_fec_mdio_driver = { .of_match_table = fs_enet_mdio_fec_match, }, .probe = fs_enet_mdio_probe, - .remove = fs_enet_mdio_remove, + .remove_new = fs_enet_mdio_remove, }; module_platform_driver(fs_enet_fec_mdio_driver); From patchwork Tue Jun 6 16:28:27 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: 13269454 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41D7C33C9A for ; Tue, 6 Jun 2023 16:28:47 +0000 (UTC) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FEB710D5 for ; Tue, 6 Jun 2023 09:28:45 -0700 (PDT) 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 1q6ZXv-00056m-Mg; Tue, 06 Jun 2023 18:28:35 +0200 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 1q6ZXv-005Y5i-0P; Tue, 06 Jun 2023 18:28:35 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q6ZXu-00Bl0b-6W; Tue, 06 Jun 2023 18:28:34 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michal Kubiak Cc: netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next v2 6/8] net: fsl_pq_mdio: Convert to platform remove callback returning void Date: Tue, 6 Jun 2023 18:28:27 +0200 Message-Id: <20230606162829.166226-7-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> References: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1855; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=ERnBGNG/jq9pugVELXQhvxuP85oTn5JkBf4NKPRymCo=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkf16oB/Qp6F67KnyVe5uI4jvWHjC8jxClkmf2e YpaAethKguJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZH9eqAAKCRCPgPtYfRL+ TkYCB/9PMUi8KdLEW8it9Pit0JZ8P3aQTViB0op3k4Y6PJFj2wW8duLdI2sx93WaxOLw5yXta2g IPZRLnsedm73tOGULOQHTjDwBCUUMVAM8u9UkAhw3i8/8tzJmZnqxlQ7fG50QNxX3oGA9iLPLor 7A6kkp0ps7gwrBOqhDsAK1apHCJLkTlRAyuX67+dvmvFuyPA0UhcTA9Nzv4sR9uUHI7q6dgTpG6 no3gXfvVBKS0+/0+nOUVM5+FaZEvlKbif80HkQrLGlGYFDevIb/6/zauoWYyLOejWLWtKxv/ReS Q16jZKoGyo3NMvCvVOI2YM4srbPyK8C+ZYYaeYooNaLTvuEz 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: netdev@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.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. Reviewed-by: Michal Kubiak Signed-off-by: Uwe Kleine-König Reviewed-by: Simon Horman --- drivers/net/ethernet/freescale/fsl_pq_mdio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/fsl_pq_mdio.c b/drivers/net/ethernet/freescale/fsl_pq_mdio.c index 9d58d8334467..01d594886f52 100644 --- a/drivers/net/ethernet/freescale/fsl_pq_mdio.c +++ b/drivers/net/ethernet/freescale/fsl_pq_mdio.c @@ -511,7 +511,7 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev) } -static int fsl_pq_mdio_remove(struct platform_device *pdev) +static void fsl_pq_mdio_remove(struct platform_device *pdev) { struct device *device = &pdev->dev; struct mii_bus *bus = dev_get_drvdata(device); @@ -521,8 +521,6 @@ static int fsl_pq_mdio_remove(struct platform_device *pdev) iounmap(priv->map); mdiobus_free(bus); - - return 0; } static struct platform_driver fsl_pq_mdio_driver = { @@ -531,7 +529,7 @@ static struct platform_driver fsl_pq_mdio_driver = { .of_match_table = fsl_pq_mdio_match, }, .probe = fsl_pq_mdio_probe, - .remove = fsl_pq_mdio_remove, + .remove_new = fsl_pq_mdio_remove, }; module_platform_driver(fsl_pq_mdio_driver); From patchwork Tue Jun 6 16:28:28 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: 13269449 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFA3830B93 for ; Tue, 6 Jun 2023 16:28:45 +0000 (UTC) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D335E40 for ; Tue, 6 Jun 2023 09:28:44 -0700 (PDT) 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 1q6ZXw-00057B-4n; Tue, 06 Jun 2023 18:28:36 +0200 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 1q6ZXv-005Y5q-ED; Tue, 06 Jun 2023 18:28:35 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q6ZXu-00Bl0g-DW; Tue, 06 Jun 2023 18:28:34 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Claudiu Manoil , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, kernel@pengutronix.de, Michal Kubiak Subject: [PATCH net-next v2 7/8] net: gianfar: Convert to platform remove callback returning void Date: Tue, 6 Jun 2023 18:28:28 +0200 Message-Id: <20230606162829.166226-8-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> References: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1806; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=1nhWu4H76ZPOWWEGeZaE1/TIVhWR/8NGrb8GOm5AGXE=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkf16ptq8Wy12bAe9/xK7FTjgbwCaoJnLtHLwo0 igLS3RfMZeJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZH9eqQAKCRCPgPtYfRL+ Tln4B/9GccrCzCNW0icu7O2XT/+dLqVOjyHIdesKADbO7gvhDhrRXtIQqH3A+z5cs4tu6tpu8FM p5slhgxvfWmQF7WHPA5JeeBgFaSiQXNC4jDmyvyakvzZ/rycy8/cYInzToSYa9x+Kzkj+X3DzGL Ig8PA3jprAATPCBEqWD7+Zr4bD37aaZX7qxtqnNbWxd/52yZ+rXimqu/CCwsbILD/Mcp89szZqR n734brslMIFN5WT8GxT78s9HVQ3BOsLm2YolPk2G+wC6I3He/53L+g0kpyMr2in9CCyji9iIWJ7 Kuwkj+yWi3BtwP/o75W+U0rPqd6sNwk2Rj7RYBfbliAo4P5C 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: netdev@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.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. Reviewed-by: Michal Kubiak Signed-off-by: Uwe Kleine-König --- drivers/net/ethernet/freescale/gianfar.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 38d5013c6fed..0c898f9ee358 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c @@ -3364,7 +3364,7 @@ static int gfar_probe(struct platform_device *ofdev) return err; } -static int gfar_remove(struct platform_device *ofdev) +static void gfar_remove(struct platform_device *ofdev) { struct gfar_private *priv = platform_get_drvdata(ofdev); struct device_node *np = ofdev->dev.of_node; @@ -3381,8 +3381,6 @@ static int gfar_remove(struct platform_device *ofdev) gfar_free_rx_queues(priv); gfar_free_tx_queues(priv); free_gfar_dev(priv); - - return 0; } #ifdef CONFIG_PM @@ -3642,7 +3640,7 @@ static struct platform_driver gfar_driver = { .of_match_table = gfar_match, }, .probe = gfar_probe, - .remove = gfar_remove, + .remove_new = gfar_remove, }; module_platform_driver(gfar_driver); From patchwork Tue Jun 6 16:28:29 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: 13269450 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 202B030B93 for ; Tue, 6 Jun 2023 16:28:45 +0000 (UTC) Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 736E4E5E for ; Tue, 6 Jun 2023 09:28:44 -0700 (PDT) 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 1q6ZXw-00057L-BZ; Tue, 06 Jun 2023 18:28:36 +0200 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 1q6ZXv-005Y5w-IU; Tue, 06 Jun 2023 18:28:35 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q6ZXu-00Bl0j-Lw; Tue, 06 Jun 2023 18:28:34 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Li Yang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kernel@pengutronix.de, Michal Kubiak Subject: [PATCH net-next v2 8/8] net: ucc_geth: Convert to platform remove callback returning void Date: Tue, 6 Jun 2023 18:28:29 +0200 Message-Id: <20230606162829.166226-9-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> References: <20230606162829.166226-1-u.kleine-koenig@pengutronix.de> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1915; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=gq+6rF927IzufgheVcUUzZnngMBPRltTHkIBQrXYRMc=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkf16qP357vq8227AGcEe5Qy+63shMi26ywf58Z dpb3jwNyluJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZH9eqgAKCRCPgPtYfRL+ TqDCB/9i5ikPgzdUcrlvN+8IP/itbXjuR+MqdGNCmbejaE6rR4WNODrNtamvr8q2oIuBBvbTf2s 4XebkDyyKAZi/i+nOvjMGctzqSDFpsVwoBQlY3F4yrfaQRuEpaGffsJcY7FewzxFlwB6TnxhAa8 7+z1BY5Z/+hRVNjhMvxl8WdfCnqDFAjt+uT+vjp/9/nAv09Ak6+xJxL9ry9ntuyg8IGIy2fB8Pc M09FcUquF7ZtwAtBFWMuox36MynJHXmVZQ9tas92S6Wa/Ezh1IE0+nAe22pY1ADQiMesRFjJhJW 8GRG/uruKGr+WJJlgxLKa4N4pULiIJwbzwZktvoATxe64fM0 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: netdev@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.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. Reviewed-by: Michal Kubiak Signed-off-by: Uwe Kleine-König Reviewed-by: Simon Horman --- drivers/net/ethernet/freescale/ucc_geth.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 7a4cb4f07c32..2b3a15f24e7c 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c @@ -3753,7 +3753,7 @@ static int ucc_geth_probe(struct platform_device* ofdev) return err; } -static int ucc_geth_remove(struct platform_device* ofdev) +static void ucc_geth_remove(struct platform_device* ofdev) { struct net_device *dev = platform_get_drvdata(ofdev); struct ucc_geth_private *ugeth = netdev_priv(dev); @@ -3767,8 +3767,6 @@ static int ucc_geth_remove(struct platform_device* ofdev) of_node_put(ugeth->ug_info->phy_node); kfree(ugeth->ug_info); free_netdev(dev); - - return 0; } static const struct of_device_id ucc_geth_match[] = { @@ -3787,7 +3785,7 @@ static struct platform_driver ucc_geth_driver = { .of_match_table = ucc_geth_match, }, .probe = ucc_geth_probe, - .remove = ucc_geth_remove, + .remove_new = ucc_geth_remove, .suspend = ucc_geth_suspend, .resume = ucc_geth_resume, };