From patchwork Mon Jul 10 07:19:39 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: 13306353 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 AF5D0BA35 for ; Mon, 10 Jul 2023 07:20:01 +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 22FCE9D for ; Mon, 10 Jul 2023 00:20:00 -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 1qIlBX-0008Dq-Tz; Mon, 10 Jul 2023 09:19:51 +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 1qIlBV-00DMeD-Hc; Mon, 10 Jul 2023 09:19:49 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qIlBU-003jlx-S6; Mon, 10 Jul 2023 09:19:48 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Madalin Bucur , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maciej Fijalkowski Cc: Russell King , netdev@vger.kernel.org, kernel@pengutronix.de, Madalin Bucur , Michal Kubiak Subject: [PATCH net-next v3 1/8] net: dpaa: Improve error reporting Date: Mon, 10 Jul 2023 09:19:39 +0200 Message-Id: <20230710071946.3470249-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230710071946.3470249-1-u.kleine-koenig@pengutronix.de> References: <20230710071946.3470249-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=1586; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=V82Fftf1dNw9TItUTZGo3u1Fg/22XIndyV4jQZLYzg8=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkq7EG1XS3XKSBe649yDexes/0YjymEihTUHKL+ qui7T7dageJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZKuxBgAKCRCPgPtYfRL+ Th+mB/9s8WZValBNtqWAXCwJ0Uv08Kl4EROQqQVk/oeZmi9X1FPXb5xn3O3gpn3JnskFEQ65o1m 0P1JYq58JXhmV+EOgdcueTXFNpc6AiYkRxE84w9jKU8hdchJDU2a5L29oxIM7uQ6lHZUbNqwd07 r7GQqerhM+EjkGJOqCvgHwxKaYPvYIt/3LNEPdzvE41328HWY1TnPEAEItdhPPrB+iGg5xumQu/ Yyqkz5ncOWvj06jatlkGJMest3fDqpuTvp2EC9JyNl5GvvVKjaZz4eKQjt/jRuawgorhMrYgQ9x B+0vHKB+UMU0Pe5FYHxsP9kUI7IUb2BBHisH8N9sEjDbBJZw 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 | 5 ++++- 1 file changed, 4 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..e0e5bf0587fc 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -3516,6 +3516,9 @@ 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 (%pE)\n", + ERR_PTR(err)); qman_delete_cgr_safe(&priv->ingress_cgr); qman_release_cgrid(priv->ingress_cgr.cgrid); @@ -3528,7 +3531,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 Mon Jul 10 07:19:40 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: 13306352 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 697DB8827 for ; Mon, 10 Jul 2023 07:20:01 +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 D022DF1 for ; Mon, 10 Jul 2023 00:19:59 -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 1qIlBX-0008Dr-Ti; Mon, 10 Jul 2023 09:19:51 +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 1qIlBW-00DMeJ-3X; Mon, 10 Jul 2023 09:19:50 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qIlBV-003jm0-4n; Mon, 10 Jul 2023 09:19:49 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Madalin Bucur , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Simon Horman , netdev@vger.kernel.org, kernel@pengutronix.de, Madalin Bucur , Michal Kubiak Subject: [PATCH net-next v3 2/8] net: dpaa: Convert to platform remove callback returning void Date: Mon, 10 Jul 2023 09:19:40 +0200 Message-Id: <20230710071946.3470249-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230710071946.3470249-1-u.kleine-koenig@pengutronix.de> References: <20230710071946.3470249-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=1897; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=b5oGU6VFpJe+OaKjdu84d2VOx9uI9NO+0S/XVCIquz0=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkq7EHwmLUZSybL9OpAT58PUT2dXkLcQEGMb1/p I/1JY191c+JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZKuxBwAKCRCPgPtYfRL+ Tp1IB/43Ea5Lz+sNbwsSWszJtGca+gPumvB16+mxFzeMqteaikt1tXHucdhwT5vZ4EMlF3lMe/e +5Xp6ytnXyX5JD66q2W/XDKzpINj7Pg1Lh5tj6RNFJH5pFDCsJcV2Gc8qAPyKyGHuzY0SW5g5XM ekmwOjJGXxNkwLsmXUInLj5dwjDuCjlR6pBnfDHkC6WZMy6mQH+R6GfB1BQbE347+Arm8FObB70 NcodwtNRIChiPAYhvpIP4S8YvTTIRr+ey1aFTubpe/trCOY0jq2uYjWsRQ4Y1OiMU2NUovX/ZCv HYQH/nl6rSQFu6/D2dgh5rs4ff0EYFTBq8MiG4trgASGZPSV 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 Reviewed-by: Simon Horman Signed-off-by: Uwe Kleine-König --- 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 e0e5bf0587fc..85e38a1ec22a 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; @@ -3530,8 +3530,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[] = { @@ -3549,7 +3547,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 Mon Jul 10 07:19:41 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: 13306357 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 C1A1DD2E0 for ; Mon, 10 Jul 2023 07:20:13 +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 3DCF29D for ; Mon, 10 Jul 2023 00:20:12 -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 1qIlBX-0008Ds-UG; Mon, 10 Jul 2023 09:19:51 +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 1qIlBW-00DMeL-6C; Mon, 10 Jul 2023 09:19:50 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qIlBV-003jm3-C2; Mon, 10 Jul 2023 09:19:49 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Wei Fang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Nicolas Ferre , Marc Kleine-Budde , Michal Kubiak , Rob Herring Cc: Shenwei Wang , Clark Wang , NXP Linux Team , netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next v3 3/8] net: fec: Convert to platform remove callback returning void Date: Mon, 10 Jul 2023 09:19:41 +0200 Message-Id: <20230710071946.3470249-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230710071946.3470249-1-u.kleine-koenig@pengutronix.de> References: <20230710071946.3470249-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=4084; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=hh8Hlfk7jR3Ldh2PazFHhhi38UfBmSNstUFCLcbVpOY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkq7EIsq1wJs5mXulQ9EpiIsx30xXKH0IDHnMfi 2OwJI8n87iJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZKuxCAAKCRCPgPtYfRL+ TviwB/9DsTFJSfudSBNeBQJEr8cPUSHXz7/aws3UKvikcpAJu0TOo3GMYUFfzb/LBezzg5EVIZh OktOE7lvYjDvzHXHf9lXTXABoWkzZvQagXrXArsEZITHVNIbxDyF20wtsYcNmpYynw9ri5KViql WxxOwEQUgQO+rnIFWZ/gFxXSsjchYHINUJAtconha8EBdNJvL/ZKdpQz4UcOXBTlRZF++OedCT+ b3Xpiw918a0/jBmVHiZzFlYryBDksBaMnK1nGHzNfljwOHRQHLOnd6sXIhClHv9Y3dH32fUdOqH /izZcOOLhV7FmGRnxUTBqBAL18h7G8Elv7kjiTUiaXmmS2Fd 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 Reviewed-by: Wei Fang Reviewed-by: Simon Horman Signed-off-by: Uwe Kleine-König --- 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 8fbe47703d47..1280da699fa3 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 Mon Jul 10 07:19:42 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: 13306354 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 635A4C147 for ; Mon, 10 Jul 2023 07:20:02 +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 CB19EEC for ; Mon, 10 Jul 2023 00:20:00 -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 1qIlBX-0008Dt-Tn; Mon, 10 Jul 2023 09:19:51 +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 1qIlBW-00DMeR-GV; Mon, 10 Jul 2023 09:19:50 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qIlBV-003jm7-JI; Mon, 10 Jul 2023 09:19:49 +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 , Simon Horman , netdev@vger.kernel.org, kernel@pengutronix.de, Madalin Bucur , Michal Kubiak Subject: [PATCH net-next v3 4/8] net: fman: Convert to platform remove callback returning void Date: Mon, 10 Jul 2023 09:19:42 +0200 Message-Id: <20230710071946.3470249-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230710071946.3470249-1-u.kleine-koenig@pengutronix.de> References: <20230710071946.3470249-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=1784; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=TgD/4vxybbLvnbww/bK+vkc7AqK9c1MlNK6LUWBwbLE=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkq7EJTqlmwEQQunDd0bSlPEN62LHSs00zvKE11 U+Wx/Ngcd2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZKuxCQAKCRCPgPtYfRL+ TtdlB/sG/ZeBIoYFx9ubFpnzC2z7A2iyCo6aHYnzjA6OTS2YyX4e9PjIJpWhL5O7NDxf4XAU4Sk QXdPc8Q3E9gnOXR+Y7o+xzsReVAOmDoK19VSI9sZeYTV78MS1rLYRgfJrJrN1PbfjK/P7Bp+aJ6 LYs87vETaKKoSC8X+7m5wVXbGAGEn5LwSkbBSEW5wO6M7CRZgDMklZ/IaGKgsH/A79v92f8604/ RjfH0F14OhxnodumcFPyAGSzzYToOitNntbLCu6oMSGxJz5kxoy6pKeH1Ws7cqCybOf++LyHR2y wCwfj7eX+Z+3IK2A0SpDD3gMrys+GzUk7jMarZvZdZ+pyPKk 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 Reviewed-by: Simon Horman Signed-off-by: Uwe Kleine-König --- 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 Mon Jul 10 07:19:43 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: 13306356 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 C0D85C2E9 for ; Mon, 10 Jul 2023 07:20:02 +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 52A9FF9 for ; Mon, 10 Jul 2023 00:20:01 -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 1qIlBY-0008Du-Cm; Mon, 10 Jul 2023 09:19:52 +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 1qIlBW-00DMeS-HZ; Mon, 10 Jul 2023 09:19:50 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qIlBV-003jmB-QI; Mon, 10 Jul 2023 09:19:49 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Pantelis Antoniou , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Simon Horman , linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, kernel@pengutronix.de, Michal Kubiak Subject: [PATCH net-next v3 5/8] net: fs_enet: Convert to platform remove callback returning void Date: Mon, 10 Jul 2023 09:19:43 +0200 Message-Id: <20230710071946.3470249-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230710071946.3470249-1-u.kleine-koenig@pengutronix.de> References: <20230710071946.3470249-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=4426; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=o8hJWptqhrQilZXLCmTvAVBm5C0CQDR2+J5SUQL3GNQ=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkq7EKCfhdmgVhgudU2qapDj79rM+DybSd89fZc F7ttNuwYHCJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZKuxCgAKCRCPgPtYfRL+ TrnrCACJfmccB+faB5Vjg3zEGd9QI8HYwrG9JQ3ZXd1uF5I913+882QWlZU4jBkQKgTe5JmRjZK /XgwROpJypKOVV1zS8CCxcOvSBdUrWmwj9f2Fg5pbXX5FV13cJn9u/xb0MTFVW+/PiVXt4QzQhR LBjd7yOvdp9pOHdEjGCdA8lVvHgvR6/TqHUJQfP2vQjLjOYSTSFSGLwzUZiK97AvjCYJ6jilsDM DY8Xzgk+KmS6UUGVWANVbbukc8IRE9RV3OqiZZX4HCxxXHEONxxfX2irRoMa12kKDzijX159hfE Uh9bt1/6gS2k0PFs8sF+946yTuSpduQpYMFI6b1tngBGPp+t 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 Reviewed-by: Simon Horman Signed-off-by: Uwe Kleine-König --- 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 59a8f0bd0f5c..1910df250c33 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 Mon Jul 10 07:19:44 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: 13306355 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 981ACC15E for ; Mon, 10 Jul 2023 07:20:02 +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 609A611B for ; Mon, 10 Jul 2023 00:20:01 -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 1qIlBX-0008Dv-U3; Mon, 10 Jul 2023 09:19:51 +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 1qIlBW-00DMeZ-Jr; Mon, 10 Jul 2023 09:19:50 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qIlBW-003jmE-1Z; Mon, 10 Jul 2023 09:19:50 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Michal Kubiak , Simon Horman Cc: netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next v3 6/8] net: fsl_pq_mdio: Convert to platform remove callback returning void Date: Mon, 10 Jul 2023 09:19:44 +0200 Message-Id: <20230710071946.3470249-7-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230710071946.3470249-1-u.kleine-koenig@pengutronix.de> References: <20230710071946.3470249-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=1910; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=pGQV2duQ+SrtCcr9YMguRz5ei9wg2bvTxI4Kxre5ejY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkq7ELJQCAmCm0fab5Y5TvWOuUKg7sFSzMAp/kN d7gUDCw5o6JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZKuxCwAKCRCPgPtYfRL+ TpRFB/9wxEligWE997+j5A1C3go3/C454wU9F2MBBs6pQt43B+16IspVTRTtGGEM4v4I8r2cUYa G0ujnoXZZiTNKJUGURY2yLeMfH7rfkQqgB0ITt+jrTDlUPmPaSo6BK/PGYFPorK6m6Z0KQ9moLb Rpkhfkiwm3j8ngo+zbQVcF7VDucW0kHHaJk7YXHUctwIxZwu7zqCUUHgfmaUiOxeh6FB8yBAidr f0akbAqonBaXadH7UpNHjodc8QuIMMUiWCasEtRuQMAloeFErng9EVMor5sZaKh38vbDKfpGNEh w0R/fh2q0RnbHaojqpYCD/WMfmVjWQg1AWSVDNW1N10Ldzw6 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 Reviewed-by: Simon Horman Signed-off-by: Uwe Kleine-König --- 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 Mon Jul 10 07:19:45 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: 13306351 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 8432D5696 for ; Mon, 10 Jul 2023 07:20:00 +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 AD54DEC for ; Mon, 10 Jul 2023 00:19:58 -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 1qIlBX-0008Dw-UA; Mon, 10 Jul 2023 09:19:51 +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 1qIlBX-00DMed-5g; Mon, 10 Jul 2023 09:19:51 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qIlBW-003jmI-70; Mon, 10 Jul 2023 09:19:50 +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 v3 7/8] net: gianfar: Convert to platform remove callback returning void Date: Mon, 10 Jul 2023 09:19:45 +0200 Message-Id: <20230710071946.3470249-8-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230710071946.3470249-1-u.kleine-koenig@pengutronix.de> References: <20230710071946.3470249-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+1h9Ev5OAcsmYgBkq7EMtq8Wy12bAe9/xK7FTjgbwCaoJnLtHLwo0 igLS3RfMZeJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZKuxDAAKCRCPgPtYfRL+ TnshB/9k8JJtWwRN0NYzMBhOcdiVhfHl6QUOCVo7q7vw0WoMajA/20lKHRumIJTqJA+VY2sg4hc g/DjFFWao2zB3bRvauyR/JF+km2T2lgKilkZZagJDQWiTlrWhp95bL0VMFklo1PIR6EnDXdlL0c ffKH5wXmbH+eysRY4/jWkTkJkfijAO++aIS6IvwPBk6PxRPk4luueLoAPhjgY1Hwz47Rczfs3G9 6VPGf/GjKckPWehyan9yoPBaZlCi7qCfy63kp23jtLqk5dEoIuXgfSHJQQ8nY+DxONfseYt8+DX 9fMD9oAxlsWHPMw1+tfnTy9XSrGfALr6frOHY5i3Xn/eja7D 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 Mon Jul 10 07:19:46 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: 13306350 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 E1AA83D8C for ; Mon, 10 Jul 2023 07:19:59 +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 8601F9D for ; Mon, 10 Jul 2023 00:19:58 -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 1qIlBY-0008Dx-Cl; Mon, 10 Jul 2023 09:19:52 +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 1qIlBX-00DMeg-D2; Mon, 10 Jul 2023 09:19:51 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qIlBW-003jmM-E9; Mon, 10 Jul 2023 09:19:50 +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 , Simon Horman Subject: [PATCH net-next v3 8/8] net: ucc_geth: Convert to platform remove callback returning void Date: Mon, 10 Jul 2023 09:19:46 +0200 Message-Id: <20230710071946.3470249-9-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230710071946.3470249-1-u.kleine-koenig@pengutronix.de> References: <20230710071946.3470249-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=1970; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=MWG25xeucMsvR/Be22NB5NNDyCslZbc0Qzb5GVk1pMw=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkq7EOuqjS5ZFQngt2RKKE2TSEuIZAjWLQTwAI5 10wJrNlKI+JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZKuxDgAKCRCPgPtYfRL+ Tk57B/wJtvoYBqKMuvOct4BqINYr9FSJR3DP/Fgg4GUkIumncV5FCZOX+P0VAQd0+7VlgM4pTz4 tRB5Embp2m/TX2OpCI0olwKBEvEjh5Z3/T37zgDxso2Meh5RHbGJy9n/XGtAZx8eoNWpmSeH+6G uK4ZTH1BYU7VZRbJ9zUp/sE4jilTi1+HBzJGfCg/4ojcs4RLipCIKvkPTMrhlxQ90NNHYMaag6W i65mPyiQfFJphVl3TTM7SgKSZpseae55jnq3Iwq6Sh193fCr8mDU6bvWbizgT4UPR4zijtL/8Ho sOy91FLLe/+3P05qiTTnyhx7AsnCi5bxgiRVyipehEyM6WYG 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 Reviewed-by: Simon Horman Signed-off-by: Uwe Kleine-König --- 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, };