From patchwork Mon Mar 13 10:36: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: 13172185 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FCB3C74A4B for ; Mon, 13 Mar 2023 10:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229960AbjCMKhX (ORCPT ); Mon, 13 Mar 2023 06:37:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbjCMKhJ (ORCPT ); Mon, 13 Mar 2023 06:37:09 -0400 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 6E8205B5C7 for ; Mon, 13 Mar 2023 03:37:08 -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 1pbfY2-0008Sw-2T; Mon, 13 Mar 2023 11:36:58 +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 1pbfY0-003pKU-G2; Mon, 13 Mar 2023 11:36:56 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pbfXz-004W3X-Sk; Mon, 13 Mar 2023 11:36:55 +0100 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 Subject: [PATCH net-next 1/9] net: dpaa: Improve error reporting Date: Mon, 13 Mar 2023 11:36:45 +0100 Message-Id: <20230313103653.2753139-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> References: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1460; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=HRAv2vE0At1EkTYyhbi8BdPRV0qfZrRgP3IEO0J+5+E=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBkDvylIj8vaQohZCbDovqwGFDSjGm2ueZYG3zed ggoSuuVq6CJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCZA78pQAKCRDB/BR4rcrs CV4eB/0bbYhAIw1NmfEN+oCs9HTWtMdXadInVbFr+dccURaM2+v+1PRoerlmiVHke9ZXpPUvaV+ hEnJbqMvqNMIWMQM/+pO3+ws1cSUUIN/0rdFR9YI3mt2QlGrxqmxOAYD24Wuf8a6/MSMlHsJR4n Ibxhj92UWWF1Y93WB9Z3p61R1NbiMVy5wNA6xERZnBUe3mQlLnaxvAfrUO/YjOQoABuAQ2ppCYm F5fEH/KFEnkmZiN9gbjptof3Ai0YDI1/kS7sTPCN2PilhL0VBkrTs/kwfSZAQXOYVtBhw2uyzny WiC5wmk6PpNYqRZNKAg0rHB1clMd070oR9TleSKbMD2uLCeO 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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. Signed-off-by: Uwe Kleine-König Acked-by: Madalin Bucur --- 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 9318a2554056..97cad3750096 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -3520,6 +3520,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(&pdev->dev, "Failed to free FQs on remove\n"); qman_delete_cgr_safe(&priv->ingress_cgr); qman_release_cgrid(priv->ingress_cgr.cgrid); @@ -3532,7 +3534,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 Mar 13 10:36: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: 13172184 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88E5CC6FD19 for ; Mon, 13 Mar 2023 10:37:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230045AbjCMKhV (ORCPT ); Mon, 13 Mar 2023 06:37:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230055AbjCMKhK (ORCPT ); Mon, 13 Mar 2023 06:37:10 -0400 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 6D4CE50FB5 for ; Mon, 13 Mar 2023 03:37:09 -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 1pbfY1-0008Sy-Pz; Mon, 13 Mar 2023 11:36:57 +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 1pbfY0-003pKc-Tj; Mon, 13 Mar 2023 11:36:56 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pbfY0-004W3a-3U; Mon, 13 Mar 2023 11:36:56 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Wei Fang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Shenwei Wang , Clark Wang , NXP Linux Team , netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next 2/9] net: fec: Don't return early on error in .remove() Date: Mon, 13 Mar 2023 11:36:46 +0100 Message-Id: <20230313103653.2753139-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> References: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1289; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=6NeNoe10qCNS1oAAJ3wmxYdcXTYONYnrWH4YyJXGi6g=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBkDvyoTD3uvYT54qcEfGm2M/XGRdVZXIaLGinLf KylAfHxIpqJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCZA78qAAKCRDB/BR4rcrs CQ28B/45w0wRq6mq3QLY8fWPee6e8EMIJCTrdHriT1imSi0mBEpGePp+/TpQGF+ffhIYfVXj/dV e7OnUPSSO4Dc10bQdtHYjb5oNyNR7wQxWviXxDfKHg8ktqbCqRHMQqpaz/9M0bwJURwczvQkTLR jFnJd98K7KVVuREYe07wrK1bukKwrGfN3+XrEQbwNjoAD8wQ1pURQ/2DRrP9OvBUMvxemYam+US MnF4OhRZQcU+sRwOeALpN7Ek8yv10dqVS99YIGjo63Dsh6Ljs5sX9uPjBK8bZSi3mRpcaekkBkZ /rtoTR7bdONLkiRYGH/pI2PeHV3DhpDtE797+OmyTj4nEkfc 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org If waking up the device in .remove() fails, exiting early results in strange state: The platform device will be unbound but not all resources are freed. E.g. the network device continues to exist without an parent. Instead of an early error return, only skip the cleanup that was already done by suspend and release the remaining resources. Signed-off-by: Uwe Kleine-König --- drivers/net/ethernet/freescale/fec_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index c73e25f8995e..31d1dc5e9196 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -4465,15 +4465,13 @@ fec_drv_remove(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; int ret; - ret = pm_runtime_resume_and_get(&pdev->dev); - if (ret < 0) - return ret; + ret = pm_runtime_get_sync(&pdev->dev); cancel_work_sync(&fep->tx_timeout_work); fec_ptp_stop(pdev); unregister_netdev(ndev); fec_enet_mii_remove(fep); - if (fep->reg_phy) + if (ret >= 0 && fep->reg_phy) regulator_disable(fep->reg_phy); if (of_phy_is_fixed_link(np)) From patchwork Mon Mar 13 10:36:47 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: 13172182 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34A1EC6FD19 for ; Mon, 13 Mar 2023 10:37:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230057AbjCMKhM (ORCPT ); Mon, 13 Mar 2023 06:37:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229934AbjCMKhH (ORCPT ); Mon, 13 Mar 2023 06:37:07 -0400 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 997B35BC8E for ; Mon, 13 Mar 2023 03:37:05 -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 1pbfY2-0008TA-E5; Mon, 13 Mar 2023 11:36:58 +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 1pbfY1-003pKm-NF; Mon, 13 Mar 2023 11:36:57 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pbfY0-004W3d-A5; Mon, 13 Mar 2023 11:36:56 +0100 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 Subject: [PATCH net-next 3/9] net: dpaa: Convert to platform remove callback returning void Date: Mon, 13 Mar 2023 11:36:47 +0100 Message-Id: <20230313103653.2753139-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> References: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1735; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=mAitTQsB2Qx6Ydp88AtMOIQB1Fqj+4Z1o3BtpHIDZY0=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBkDvyrN0KI02jSIM2HytPYbDQkHNqycZnvS4Ez4 HmpvSoWTrSJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCZA78qwAKCRDB/BR4rcrs CYUwB/4i15xVlEcavZZCrW7gd8xq15lip/HtqelNtlkvci30ai+/fqIFtNY0h10hFtyUQiP8Ep/ kS8a+gw7ODP0fU1UQR5L92tFSocKcEw2JPENb1Gi5YuWNy3uX7bThhOlRuhzFvOLpPmRKTo9sHy 9h8RDqC571kPbE8e+vrFExwGBBd5jkzvbaUxGrbqNDAcdxtPr64E4q9SVzuNYS3fppnSkCj0+wG DZhqWkXSIen+QUbSmkgaLw4le9wt68oT8aAKY7Da0HVKKLSbreXELVAAG+FpeFUOai64QibtYn6 erJ5Odzz/cy/roc3I3VHL+RjiGLyNcOGZyEvaIh2F1NL9bRw 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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. 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 97cad3750096..477db267b95f 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -3501,7 +3501,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; @@ -3533,8 +3533,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[] = { @@ -3552,7 +3550,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 Mar 13 10:36:48 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: 13172187 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95DE7C61DA4 for ; Mon, 13 Mar 2023 10:37:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbjCMKhv (ORCPT ); Mon, 13 Mar 2023 06:37:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229888AbjCMKht (ORCPT ); Mon, 13 Mar 2023 06:37:49 -0400 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 62E5B5F6CB for ; Mon, 13 Mar 2023 03:37:28 -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 1pbfY7-0008Sz-Qj; Mon, 13 Mar 2023 11:37:03 +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 1pbfY1-003pKg-3E; Mon, 13 Mar 2023 11:36:57 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pbfY0-004W3g-G8; Mon, 13 Mar 2023 11:36:56 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Wei Fang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Wolfram Sang , Chris Packham , Andy Shevchenko , Damien Le Moal , Christophe Leroy , Michael Ellerman , Mark Brown , Marc Kleine-Budde Cc: Shenwei Wang , Clark Wang , NXP Linux Team , netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next 4/9] net: fec: Convert to platform remove callback returning void Date: Mon, 13 Mar 2023 11:36:48 +0100 Message-Id: <20230313103653.2753139-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> References: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3933; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=Tn6WOu1HGOkvfPK3uiscj1uWDMi6j9dnPWXMHrXc9Hc=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBkDvyu8TGZ21CzC6xkjn2iQPU3BFTuLGzSJg6L/ EbvTApN/tGJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCZA78rgAKCRDB/BR4rcrs CepcB/4shPCAmo9Qfg/sf+X+/NEQwDW/rn/x4OKCH90FioVudIVvEyjXf449bWG1lPA2W5U2USZ BC3KvW9GMfMJKAH5NNKPaFigEeqT9jnqf1A948QKhp8LBxXvTN0dw7KWWKnBMWoxyXLhVLb/cHN biQkqvzW6qp4WgWrjwR6yUxNhPx4pOyd6n7xNlw8LDWY1JtsYGV3CdgqJuNYLJRmk8X+oqk+gYj i9CosD0ZWCFYoHSPVmQxJKSmt5nSu3Ep71gRss0LaRCPSbc0n9FIwRagnOv7suZNyO3kK0eD2Rr N2HMk355u1pTIgaNF4G8xMoIdSVlNmEiIMqtcQfOamZgJoBS 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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. 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 31d1dc5e9196..2725feb6fc02 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -4457,7 +4457,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); @@ -4484,7 +4484,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) @@ -4640,7 +4639,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 a7f4c3c29f3e..b61fa27e1592 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 Mar 13 10:36:49 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: 13172181 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21C05C61DA4 for ; Mon, 13 Mar 2023 10:37:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230047AbjCMKhK (ORCPT ); Mon, 13 Mar 2023 06:37:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229888AbjCMKhG (ORCPT ); Mon, 13 Mar 2023 06:37:06 -0400 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 5A8E55B5D0 for ; Mon, 13 Mar 2023 03:37:05 -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 1pbfY2-0008TR-Nw; Mon, 13 Mar 2023 11:36:58 +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 1pbfY2-003pKu-3o; Mon, 13 Mar 2023 11:36:58 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pbfY0-004W3l-Mv; Mon, 13 Mar 2023 11:36:56 +0100 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 Subject: [PATCH net-next 5/9] net: fman: Convert to platform remove callback returning void Date: Mon, 13 Mar 2023 11:36:49 +0100 Message-Id: <20230313103653.2753139-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> References: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1622; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=S0b1ub64SJQANCQ1Ra0dif/j9QVEkLXZ8ZAJPlxmGxk=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBkDvyxV0JP0HqHjuDS8KYzq/dTxHffEBpqMP0wK N2dLQ99+OmJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCZA78sQAKCRDB/BR4rcrs CQODB/4t0xbdHK2zj9f8e+nY9BDoZrVctvFf+gmq0ruuElwqqpaz5CCUH2xaKpXRGQ+McugQak+ wuBttC+uwpuWbunc4B/e8DPP+pZ1UwHQLIeMVH9XvSlzsQmZ26T4tQZMAQMvqGhD8ZTT+zcBSid UrWqIUbINXYPpfZQyS6dDVmDtKHyqwrvxwhjE8VLHOJ6ohXUfWWolUo/9QsPvTBAI3adjHZfBSW /eusMHxHkB/ik0fnnxP8Sx8To9UJ17JE1Ts2Hd3gv/87VxgB8ML2kJVmfEDd0ChR2B0pl7sE/jG E4xpU2cojPY1VLUjkYdcWoxbQCFGecf37IFjHhdhyNge83gT 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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. 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 Mar 13 10:36:50 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: 13172186 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C351C61DA4 for ; Mon, 13 Mar 2023 10:37:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230083AbjCMKhZ (ORCPT ); Mon, 13 Mar 2023 06:37:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230084AbjCMKhU (ORCPT ); Mon, 13 Mar 2023 06:37:20 -0400 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 78CEA5C101 for ; Mon, 13 Mar 2023 03:37:13 -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 1pbfY3-0008TB-LJ; Mon, 13 Mar 2023 11:36:59 +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 1pbfY1-003pKq-RD; Mon, 13 Mar 2023 11:36:57 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pbfY0-004W3o-UC; Mon, 13 Mar 2023 11:36:56 +0100 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 Subject: [PATCH net-next 6/9] net: fs_enet: Convert to platform remove callback returning void Date: Mon, 13 Mar 2023 11:36:50 +0100 Message-Id: <20230313103653.2753139-7-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> References: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4317; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=f76Nc+3Oj46FRb2E4EO2ZY/wW5QfMQpwCUVv+HL4buI=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBkDvy0aILmjnPX5g40v+YBRkVfpaZRrV7rMZSSv lt9XXtQK6+JATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCZA78tAAKCRDB/BR4rcrs CYXqB/kBbTM4n38sSUi5JLd5T5vzRR0UY8hprexhA2dm4GaAksUxGWpjHO2/QpzLpl4FVFQ93FJ f+vY5gf/L5+NEAoUfYcyzW1llhcU0v4gEnV1X7etBzvuQL9PVVvKVq2eo5LWgzZWZwhfZbigkeX sbZ5XcJdUFXGEH8n0weSKLmD3Md8qfDAs1+FQCJq6Qm/J2u5FCkU5vf57XiWCdG0MYSoqr3ep1J B9cg2+O48COY20utQ/Q5dGj5SplL75Vdm/Vy5RiHUhAeROVLbzpG5vls6kX7bPseBTrSoru9nBQ Nht6dB/Uet26KlzCmgYAAj0czWSFeIqEjYLgvVKHOBuov0/B 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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. 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 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 Mon Mar 13 10:36:51 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: 13172179 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CE84C61DA4 for ; Mon, 13 Mar 2023 10:37:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229958AbjCMKhH (ORCPT ); Mon, 13 Mar 2023 06:37:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbjCMKhF (ORCPT ); Mon, 13 Mar 2023 06:37:05 -0400 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 D48D35B5C7 for ; Mon, 13 Mar 2023 03:37:04 -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 1pbfY3-0008UB-1F; Mon, 13 Mar 2023 11:36:59 +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 1pbfY2-003pKx-8w; Mon, 13 Mar 2023 11:36:58 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pbfY1-004W3s-3R; Mon, 13 Mar 2023 11:36:57 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next 7/9] net: fsl_pq_mdio: Convert to platform remove callback returning void Date: Mon, 13 Mar 2023 11:36:51 +0100 Message-Id: <20230313103653.2753139-8-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> References: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1801; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=hzWHp/HwFk/FSJZD+6UkWO68YL4jbK5pFylJ3bNik6g=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBkDvy4Zln6QDgaXuywmRw9dPa45H/CCZbb+YDEg P9C2oMm0vSJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCZA78uAAKCRDB/BR4rcrs CY+UCACNEmFQg1WWjEKYA3d3YrE46DGM5GNgrrebVFX/86oKr6intUIqGTDSBfbElgUDaLlQDWS TKiFyGd90QOEzjT0lO7/8EnL5Eq1Kv0prZ6mOH+6rfAJRPWuYzw6Svcl0soCbBARHM2qBxyX4ll 8WIOkuYlp4GpjnkTdDzw/9SB9HbGnLZmgRAbD/+z8tzUAlb7ZNrWnZi3xmOak52OBQrRqsnUtIj bqZsS7pi1dw7JeZW/QjbndIqz3oHPxE99050+McbX3K0gf6j3JvObj913tOKNDo8D3l949ltuXA KlxzqTDTvV7oTSiI/BNG0pKMbFdtF0dPPuq6AlMFLrKcpe8i 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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. 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 Mar 13 10:36:52 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: 13172180 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 507ADC74A4B for ; Mon, 13 Mar 2023 10:37:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbjCMKhI (ORCPT ); Mon, 13 Mar 2023 06:37:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229765AbjCMKhG (ORCPT ); Mon, 13 Mar 2023 06:37:06 -0400 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 C8AEB52F41 for ; Mon, 13 Mar 2023 03:37:04 -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 1pbfY2-0008UF-WF; Mon, 13 Mar 2023 11:36:59 +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 1pbfY2-003pKy-A1; Mon, 13 Mar 2023 11:36:58 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pbfY1-004W3w-9b; Mon, 13 Mar 2023 11:36:57 +0100 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 Subject: [PATCH net-next 8/9] net: gianfar: Convert to platform remove callback returning void Date: Mon, 13 Mar 2023 11:36:52 +0100 Message-Id: <20230313103653.2753139-9-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> References: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1752; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=ANct817AabQe+ZICld63qB89mOm5tn/gNN+Q03QCujU=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBkDvy7anLBYutFlIyEOEKojok0IVHsUb2+6D9Nm 1L3oC0zK9uJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCZA78uwAKCRDB/BR4rcrs CVqTCACMnH/6xtzTo26+NKgXevwe+fxZq35tGABD3CzILQXofgQqHDVohFE8ybvgRw/2rvihyup 4UmndM1jkqR9+exL6eMeT8kvJl+DND/QNH8r2gPDR3jBKRNkOY2F982DT3kwInaUxLubaOoYDLJ Jx5aMIuhb+kepVS9+gnR2VMJTmW2m1wgNsS6Qlbp4bNq5l5yEOCfvPQ0d/3q1I4bmixY1P028Ea PDazaFGOAO28XNngpjFX7ZcSnLJYTmlf2JeyHEIU0sKH3Wos+UH1ILzh41uPFjzeY4rWs6JfRA6 cHe0XlZCz6Hktw0aQgsOxfvXvPYtwJE7Qr43pqT4HtdH2BXb 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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. 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 b2def295523a..2f578ad7788d 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 Mar 13 10:36:53 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: 13172183 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2302C61DA4 for ; Mon, 13 Mar 2023 10:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230071AbjCMKhN (ORCPT ); Mon, 13 Mar 2023 06:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229792AbjCMKhG (ORCPT ); Mon, 13 Mar 2023 06:37:06 -0400 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 40BC950FB5 for ; Mon, 13 Mar 2023 03:37:05 -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 1pbfY3-0008UR-LJ; Mon, 13 Mar 2023 11:36:59 +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 1pbfY2-003pL4-Fi; Mon, 13 Mar 2023 11:36:58 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pbfY1-004W3z-GI; Mon, 13 Mar 2023 11:36:57 +0100 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 Subject: [PATCH net-next 9/9] net: ucc_geth: Convert to platform remove callback returning void Date: Mon, 13 Mar 2023 11:36:53 +0100 Message-Id: <20230313103653.2753139-10-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230313103653.2753139-1-u.kleine-koenig@pengutronix.de> References: <20230313103653.2753139-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=hiPfQ6LuVEv3fcOfxf1fooE2/sTKihR8xeGbsyguKpE=; b=owEBbQGS/pANAwAKAcH8FHityuwJAcsmYgBkDvy+zOYR8NtOaP8TlwSO+iN4rUOWLMakd6JyL ljJuPMgBreJATMEAAEKAB0WIQR+cioWkBis/z50pAvB/BR4rcrsCQUCZA78vgAKCRDB/BR4rcrs CSGmB/sEXrdkvsfxvj/SPIlDEPwwzN68YX5VDNIO1CG5oeoLAFFfaaKkGS3HUEBdlSF26a6jOYu /JmgBNDiVtvp4NAo1n586V2i/5e7dqqjZqaSGGiwHVozRBh5KnIfMbEbQ4WphWzprP/232Zlfzr C/WkGG3jPKexIRm7wD8WTMUR52NK3nAuWols7AED7z+EQ2bQ/NQYetBa3GTeBG6q7oLPbu8Ummw Oqw6PsHVwjtiGU6q/0dCNteNJ/IOZLfzOIx0eLobgvbBDVmZMmEOqa2nmhvZgFkZpdjQnBJHYRo pJVXrJ3aS/8zcUj2KpbC6gXutJsyb2jxS2O4eBZh1lnZ5XJ+ 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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. 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, };