From patchwork Mon Dec 4 18:30: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: 13478917 X-Patchwork-Delegate: kuba@kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF04CD5 for ; Mon, 4 Dec 2023 10:31:33 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rADj2-00038x-Fx; Mon, 04 Dec 2023 19:31:24 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rADj1-00DZmS-Oh; Mon, 04 Dec 2023 19:31:23 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rADj1-00EE7B-FP; Mon, 04 Dec 2023 19:31:23 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alex Elder , netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next v2 1/9] net: ipa: Convert to platform remove callback returning void Date: Mon, 4 Dec 2023 19:30:41 +0100 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: 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=2742; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=i2wI1xIadZHZVxHz3LgCDMBnM/dtNyelG/0iXlEJ5xs=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbhrUi54GzU/9XeBAfnus3jPPmJ0bFkjuTXU3d KWtuR03VuqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZW4a1AAKCRCPgPtYfRL+ Tp2pCACi0vKu/eT7/h53Cl+j/r6WbEgs3d22Q3tTXgOKVdTkS5mIZmn9xUPBUgIsEhw11FCq27q pFK6DNJ2IPBomhVQXwdbzwya2VoVgC6Tk88eg1skJlH1U3fT0i62lknGM4BeKF4OpGWQ8/qwK3R sJtihjGrPOJQbFG4VcJJyuTDfRn+ZpblJ9axJ58vH7Q11HBSGrmTNKSEDCViF1PM9umpj47KKRI bEdP0J0Er7sD5CeVGSLA9Ci8jKGZfB103ptTM/1NDFkZ8xMmnwk+aKipT8RG3qPUkKOPgXhWf/c iR6hctbdKURZQJ/0YizP5+NJ/kfGhRVV94Dn0BgYKV8ZFRr/ 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: 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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Link: https://lore.kernel.org/r/20231117095922.876489-3-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König --- drivers/net/ipa/ipa_main.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 86884c21e792..00475fd7a205 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -943,7 +943,7 @@ static int ipa_probe(struct platform_device *pdev) return ret; } -static int ipa_remove(struct platform_device *pdev) +static void ipa_remove(struct platform_device *pdev) { struct ipa *ipa = dev_get_drvdata(&pdev->dev); struct ipa_power *power = ipa->power; @@ -966,8 +966,16 @@ static int ipa_remove(struct platform_device *pdev) usleep_range(USEC_PER_MSEC, 2 * USEC_PER_MSEC); ret = ipa_modem_stop(ipa); } - if (ret) - return ret; + if (ret) { + /* + * Not cleaning up here properly might also yield a + * crash later on. As the device is still unregistered + * in this case, this might even yield a crash later on. + */ + dev_err(dev, "Failed to stop modem (%pe), leaking resources\n", + ERR_PTR(ret)); + return; + } ipa_teardown(ipa); } @@ -985,17 +993,6 @@ static int ipa_remove(struct platform_device *pdev) ipa_power_exit(power); dev_info(dev, "IPA driver removed"); - - return 0; -} - -static void ipa_shutdown(struct platform_device *pdev) -{ - int ret; - - ret = ipa_remove(pdev); - if (ret) - dev_err(&pdev->dev, "shutdown: remove returned %d\n", ret); } static const struct attribute_group *ipa_attribute_groups[] = { @@ -1008,8 +1005,8 @@ static const struct attribute_group *ipa_attribute_groups[] = { static struct platform_driver ipa_driver = { .probe = ipa_probe, - .remove = ipa_remove, - .shutdown = ipa_shutdown, + .remove_new = ipa_remove, + .shutdown = ipa_remove, .driver = { .name = "ipa", .pm = &ipa_pm_ops, From patchwork Mon Dec 4 18:30: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: 13478920 X-Patchwork-Delegate: kuba@kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DA1CFA for ; Mon, 4 Dec 2023 10:31:34 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rADj2-00038y-IA; Mon, 04 Dec 2023 19:31:24 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rADj2-00DZmV-49; Mon, 04 Dec 2023 19:31:24 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rADj1-00EE7F-Qu; Mon, 04 Dec 2023 19:31:23 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Marc Kleine-Budde , Nick Child , Christian Marangi , netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next v2 2/9] net: fjes: Convert to platform remove callback returning void Date: Mon, 4 Dec 2023 19:30:42 +0100 Message-ID: <4889ac6a7ffa9b02fa5cdd2d3212e739741f80b8.1701713943.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: 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=1925; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=V5CcWa1dpN00caSyAaQLtByRj9WVXqyg1ynTnYkiNHE=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbhrWgJ/2GgCDVC3ayzVgVSekWhGlhbtXdFc2i OyYKo+GjBmJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZW4a1gAKCRCPgPtYfRL+ TnVUB/4v0QFWsoGdGSEtGIFWiUfRO5gol6wb6oaKUOL+ozVu2k5Oeu3cNHqh+rLSYBkCxfmMDoB rmtliesTqf5xppGXjrfVJCm7lNbqX7NSrd/8lY9uRcYC84JHkjAv5gnyNT5ybMm6oMMIExg1JPz swQ5mglXIQ9p3KMjCUHou3+YkvJavcc5B98KzNY2SfE+6yn5DRFg8T4wmFB6oQkryjubdQtEwVy NFPH0XLZbQ4PGuvbLYkHayGDdfq39xwZPSln/dyizU6yZfWVxc29BRVsxrqSQmO1K1IcfxhoVQJ f1U5n3WwO+fDusqKgbZp0RxdVoy8oLAK8CnMqqy5GZjanPj/ 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: 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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Link: https://lore.kernel.org/r/20231117095922.876489-4-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König --- drivers/net/fjes/fjes_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/fjes/fjes_main.c b/drivers/net/fjes/fjes_main.c index cd8cf08477ec..5fbe33a09bb0 100644 --- a/drivers/net/fjes/fjes_main.c +++ b/drivers/net/fjes/fjes_main.c @@ -1438,7 +1438,7 @@ static int fjes_probe(struct platform_device *plat_dev) } /* fjes_remove - Device Removal Routine */ -static int fjes_remove(struct platform_device *plat_dev) +static void fjes_remove(struct platform_device *plat_dev) { struct net_device *netdev = dev_get_drvdata(&plat_dev->dev); struct fjes_adapter *adapter = netdev_priv(netdev); @@ -1462,8 +1462,6 @@ static int fjes_remove(struct platform_device *plat_dev) netif_napi_del(&adapter->napi); free_netdev(netdev); - - return 0; } static struct platform_driver fjes_driver = { @@ -1471,7 +1469,7 @@ static struct platform_driver fjes_driver = { .name = DRV_NAME, }, .probe = fjes_probe, - .remove = fjes_remove, + .remove_new = fjes_remove, }; static acpi_status From patchwork Mon Dec 4 18:30: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: 13478919 X-Patchwork-Delegate: kuba@kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 002FDFF for ; Mon, 4 Dec 2023 10:31:35 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rADj3-00039G-3o; Mon, 04 Dec 2023 19:31:25 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rADj2-00DZmY-Ea; Mon, 04 Dec 2023 19:31:24 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rADj2-00EE7J-5P; Mon, 04 Dec 2023 19:31:24 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Andrew Lunn , Heiner Kallweit , Russell King , linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, kernel@pengutronix.de, Geert Uytterhoeven Subject: [PATCH net-next v2 3/9] net: pcs: rzn1-miic: Convert to platform remove callback returning void Date: Mon, 4 Dec 2023 19:30:43 +0100 Message-ID: <82b728e14a68c421e269eff3b8083d9d6e62d956.1701713943.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: 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=1766; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=i2Z/P9sGagmWu34TWxQ4CGYIrQslMBYPtFr1evQ8ocA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbhrZZQzhaE2Njvl74xVu88W/97/IYyx7lh2fL 9ZgukGWjZiJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZW4a2QAKCRCPgPtYfRL+ TmZKB/4y1UoT4nRM6Irp0y1hLaDsiyo8WbvOCoLMAlDkrCyJphl6+TjtElz3Wd2MsDLEXmeeUQ+ eb8Yqx8kjUo0G0l9jEyIIkLvuXHhW112S6g80zqRO2zuAB+76fyqWJv/e66b/0J3CyqwFbUrDvi 3v76RpJpZzOQjaqrR7E0f2lvJsuj9OukWIkULqIGcsendvpFKHpCoP+uYZ3Cld7Yd9HJLThzSHt DL80L9TqR6HX+nJXWlblCrXFJaAc3gXxmbeFxz7iWK8D/YMYV/9awQXSq+FOUl+sXUYP3dPgRIN hfyeELifJVhkQEh73cvSIh0bHLtaemfM00B3je0y1lrg6KwI 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: 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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Reviewed-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20231117095922.876489-5-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König Reviewed-by: Russell King (Oracle) --- drivers/net/pcs/pcs-rzn1-miic.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/pcs/pcs-rzn1-miic.c b/drivers/net/pcs/pcs-rzn1-miic.c index 97139c07130f..d93f84fbb1fd 100644 --- a/drivers/net/pcs/pcs-rzn1-miic.c +++ b/drivers/net/pcs/pcs-rzn1-miic.c @@ -505,11 +505,9 @@ static int miic_probe(struct platform_device *pdev) return ret; } -static int miic_remove(struct platform_device *pdev) +static void miic_remove(struct platform_device *pdev) { pm_runtime_put(&pdev->dev); - - return 0; } static const struct of_device_id miic_of_mtable[] = { @@ -525,7 +523,7 @@ static struct platform_driver miic_driver = { .of_match_table = miic_of_mtable, }, .probe = miic_probe, - .remove = miic_remove, + .remove_new = miic_remove, }; module_platform_driver(miic_driver); From patchwork Mon Dec 4 18:30: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: 13478918 X-Patchwork-Delegate: kuba@kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46B24CA for ; Mon, 4 Dec 2023 10:31:33 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rADj3-00039O-BI; Mon, 04 Dec 2023 19:31:25 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rADj2-00DZmd-Sv; Mon, 04 Dec 2023 19:31:24 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rADj2-00EE7O-Ja; Mon, 04 Dec 2023 19:31:24 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Russell King , Andrew Lunn , Heiner Kallweit , netdev@vger.kernel.org, kernel@pengutronix.de, Russell King Subject: [PATCH net-next v2 4/9] net: sfp: Convert to platform remove callback returning void Date: Mon, 4 Dec 2023 19:30:44 +0100 Message-ID: <7c1d50d559c0e0e36a20eb3e410f6e9d3f884b6f.1701713943.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1915; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=ksAknJksbw+L56iVSgvs+eTBS5f0dAwxllBF4NUUw14=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbhrcd5G8mOX+Ay2gPcMcoVzJfoaS6mWdw0O66 wW06i5vESaJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZW4a3AAKCRCPgPtYfRL+ TqNXCAConpXJxBEaV3ns0IrmTYH2LKFl46PMzNh0Wt2LAYSudtjg3Ku3thYNMObYDwyFj2ZiqqY 9/VzPz/SkyFDRxQIOlAZkQSyABTHtNVwM263iNMvhRHzIvkCXZYDIKhuMwkV+vLSNlvFMY8KTs3 VBa+YfEB0eD4QLRLnbgBSHFATpmf4W6JC13iebAM85kvsCA6W3SJnmbplm3Sf+WV/xhFZFatpBv lxuJQn1WivJI6KZbYeQjLYt2iADAuBWr5uJD/4UObaq224zyON2BXgGcZYfBw/IVL+Pq4k2PUPi 6y6klc25IMP3F0juFHQ7xc7aqt3TEbW7CHga05TAzMgEDBpL 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: 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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Reviewed-by: Russell King (Oracle) Link: https://lore.kernel.org/r/20231117095922.876489-6-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König Reviewed-by: Russell King (Oracle) --- drivers/net/phy/sfp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/sfp.c b/drivers/net/phy/sfp.c index 5eb00295b8bf..3780a96d2caa 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -3097,7 +3097,7 @@ static int sfp_probe(struct platform_device *pdev) return 0; } -static int sfp_remove(struct platform_device *pdev) +static void sfp_remove(struct platform_device *pdev) { struct sfp *sfp = platform_get_drvdata(pdev); @@ -3107,8 +3107,6 @@ static int sfp_remove(struct platform_device *pdev) rtnl_lock(); sfp_sm_event(sfp, SFP_E_REMOVE); rtnl_unlock(); - - return 0; } static void sfp_shutdown(struct platform_device *pdev) @@ -3129,7 +3127,7 @@ static void sfp_shutdown(struct platform_device *pdev) static struct platform_driver sfp_driver = { .probe = sfp_probe, - .remove = sfp_remove, + .remove_new = sfp_remove, .shutdown = sfp_shutdown, .driver = { .name = "sfp", From patchwork Mon Dec 4 18:30: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: 13478916 X-Patchwork-Delegate: kuba@kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 284ACAF for ; Mon, 4 Dec 2023 10:31:33 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rADj3-0003BD-OL; Mon, 04 Dec 2023 19:31:25 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rADj3-00DZmh-80; Mon, 04 Dec 2023 19:31:25 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rADj2-00EE7W-V8; Mon, 04 Dec 2023 19:31:24 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Zhao Qiang , netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kernel@pengutronix.de Subject: [PATCH net-next v2 5/9] net: wan/fsl_ucc_hdlc: Convert to platform remove callback returning void Date: Mon, 4 Dec 2023 19:30:45 +0100 Message-ID: <8c9ffca75ea24810f9ba05a514d5ad59847cc4fe.1701713943.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: 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=1959; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=BXCJ5RBs9n3Xi3nRuucIGJWxYyOhe3q5AcmI4Pk19QA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbhreCWyIvQi2zzhLN39R3snoWndXP7tWACp/a BNFVuU6oJaJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZW4a3gAKCRCPgPtYfRL+ TuoxB/wMOkST4NGR4hCW1u/Upa0K59hrPLOb5NckuHsuoHLXnqo1xvywmr7V23q5MsJTDuWxob1 2m2dsZkEepK/DhPiQmk7UqEBGt4B6qRZZNU0hdrhoz5C1lhYdvh3q/dwvTunHkWDy0uRnWJPUIb B9KT2KpaKViU06zwdgNo2Sz8bJvlt0ZIFmueD2pmp/VZnOPCMAlcNPRwPNOL+riC8/EurbdGZm9 rtxGTKSFi+vTTdft3kuzua2KfVvNHo7etZ9MWhmzzh7RsYPaRs8v4QZS/TzJC2x9eO9qaHzTawR lEzzcO1THqnxLB85xtQdQC3iWI2AORUgIyT5lpyJ4ApL8/Io 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: 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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Link: https://lore.kernel.org/r/20231117095922.876489-7-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König --- drivers/net/wan/fsl_ucc_hdlc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/wan/fsl_ucc_hdlc.c b/drivers/net/wan/fsl_ucc_hdlc.c index fd50bb313b92..605e70f7baac 100644 --- a/drivers/net/wan/fsl_ucc_hdlc.c +++ b/drivers/net/wan/fsl_ucc_hdlc.c @@ -1259,7 +1259,7 @@ static int ucc_hdlc_probe(struct platform_device *pdev) return ret; } -static int ucc_hdlc_remove(struct platform_device *pdev) +static void ucc_hdlc_remove(struct platform_device *pdev) { struct ucc_hdlc_private *priv = dev_get_drvdata(&pdev->dev); @@ -1277,8 +1277,6 @@ static int ucc_hdlc_remove(struct platform_device *pdev) kfree(priv); dev_info(&pdev->dev, "UCC based hdlc module removed\n"); - - return 0; } static const struct of_device_id fsl_ucc_hdlc_of_match[] = { @@ -1292,7 +1290,7 @@ MODULE_DEVICE_TABLE(of, fsl_ucc_hdlc_of_match); static struct platform_driver ucc_hdlc_driver = { .probe = ucc_hdlc_probe, - .remove = ucc_hdlc_remove, + .remove_new = ucc_hdlc_remove, .driver = { .name = DRV_NAME, .pm = HDLC_PM_OPS, From patchwork Mon Dec 4 18:30: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: 13478922 X-Patchwork-Delegate: kuba@kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1865B116 for ; Mon, 4 Dec 2023 10:31:37 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rADj4-0003D8-2h; Mon, 04 Dec 2023 19:31:26 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rADj3-00DZml-KI; Mon, 04 Dec 2023 19:31:25 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rADj3-00EE7a-AF; Mon, 04 Dec 2023 19:31:25 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Linus Walleij , Imre Kaloz , linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next v2 6/9] net: wan/ixp4xx_hss: Convert to platform remove callback returning void Date: Mon, 4 Dec 2023 19:30:46 +0100 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: 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=1771; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=R3GOFhoPlqaWIMswQrULsAL9Ly7E9xywKQWRfTObpGA=; b=owGbwMvMwMXY3/A7olbonx/jabUkhtQ8qQdef+tjSo9sZrs+L+ia9Wf1jsNRnBYtE7LmXrJ/L rNJ/2hxJ6MxCwMjF4OsmCKLfeOaTKsqucjOtf8uwwxiZQKZwsDFKQAT4eNk/1+Tv4XjYmTx/d8y fZdq3Xq3Tl46Savhf0448yeeA4HS0QU7N89a99DXzU7e7ipv0NmupCnVL7Yvs/Th5ePI+nZ64qk 7N9IFP1XPmhGuxhAjYCF2uHvS6VrJZ2xBRp8vBblFxfH5R7qlXX2a3xK6Tv7fn/kBMf6Fje4sHP K1C9Z4zfV5fD1g8998D8mjLz5l2btWamkol/IznRfT083mt+1bPd/r+PrTnHJFV4s/zc3+dTdfU abyZVnf8vMVIgk8j1pmZR5/HDalOeT3YfGNP+QaSgv+3/KSYlXtE075Vmw/lyuwV8zcOdXv7Cxt DZ0Vc89Urt5osuqLwcGJvInhUYrRijllxeu7779as9kcAA== 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: 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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Link: https://lore.kernel.org/r/20231117095922.876489-8-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König Acked-by: Linus Walleij --- drivers/net/wan/ixp4xx_hss.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c index b09f4c235142..931c5ca79ea5 100644 --- a/drivers/net/wan/ixp4xx_hss.c +++ b/drivers/net/wan/ixp4xx_hss.c @@ -1522,20 +1522,19 @@ static int ixp4xx_hss_probe(struct platform_device *pdev) return err; } -static int ixp4xx_hss_remove(struct platform_device *pdev) +static void ixp4xx_hss_remove(struct platform_device *pdev) { struct port *port = platform_get_drvdata(pdev); unregister_hdlc_device(port->netdev); free_netdev(port->netdev); npe_release(port->npe); - return 0; } static struct platform_driver ixp4xx_hss_driver = { .driver.name = DRV_NAME, .probe = ixp4xx_hss_probe, - .remove = ixp4xx_hss_remove, + .remove_new = ixp4xx_hss_remove, }; module_platform_driver(ixp4xx_hss_driver); From patchwork Mon Dec 4 18:30: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: 13478921 X-Patchwork-Delegate: kuba@kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B560109 for ; Mon, 4 Dec 2023 10:31:36 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rADj4-0003DX-EP; Mon, 04 Dec 2023 19:31:26 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rADj3-00DZmp-UM; Mon, 04 Dec 2023 19:31:25 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rADj3-00EE7e-Kg; Mon, 04 Dec 2023 19:31:25 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Stephan Gerhold , Andy Gross , Bjorn Andersson , Konrad Dybcio , Loic Poulain , Sergey Ryazanov , Johannes Berg , netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next v2 7/9] net: wwan: qcom_bam_dmux: Convert to platform remove callback returning void Date: Mon, 4 Dec 2023 19:30:47 +0100 Message-ID: <49795ee930be6a9a24565e5e7133e6f8383ab532.1701713943.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: 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=2063; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=gecgcvbwx7q0Th+9mTV/aok7FkCDGBOA1YzmdyxXVcQ=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbhrj/xzui6tM9WRwNtnUzQcyOhsKbD02bNGyC eMLVfMnSvuJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZW4a4wAKCRCPgPtYfRL+ TldECAC0hnSJMtkR/CIgqW7VpDUGbGYWLuWSvEbYWhswMpsImayQur67L+P/nuG98R2sBicMTw7 gHVH2Sy3K6G8cVZhMKWW2MIIMmd6fEAT03LkW93Gt0j+0xJWpS4SUt1/rEroCTzxgKjrNX7qe/Y 3JFQaPQcjZnj1P+tCYJEmlc4m5vb2wbJUNQYuSfmHXHwsLv9hwB2BnA2HsJvrGRg5jCdxX58aYI ymdRqHjO+F5XkpKwQMcyVqNum+VXyFEFP+GJiiQSnC5Yiek8ggczj8KpVRXzxEelfHnmTQ/DRHe rT60ffp+pg/GK4Pl3NabFP8U4QC3rpt7SVuFRlHyFIpLuEaB 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: 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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Reviewed-by: Sergey Ryazanov Link: https://lore.kernel.org/r/20231117095922.876489-9-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König --- drivers/net/wwan/qcom_bam_dmux.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/wwan/qcom_bam_dmux.c b/drivers/net/wwan/qcom_bam_dmux.c index 17d46f4d2913..26ca719fa0de 100644 --- a/drivers/net/wwan/qcom_bam_dmux.c +++ b/drivers/net/wwan/qcom_bam_dmux.c @@ -846,7 +846,7 @@ static int bam_dmux_probe(struct platform_device *pdev) return 0; } -static int bam_dmux_remove(struct platform_device *pdev) +static void bam_dmux_remove(struct platform_device *pdev) { struct bam_dmux *dmux = platform_get_drvdata(pdev); struct device *dev = dmux->dev; @@ -877,8 +877,6 @@ static int bam_dmux_remove(struct platform_device *pdev) disable_irq(dmux->pc_irq); bam_dmux_power_off(dmux); bam_dmux_free_skbs(dmux->tx_skbs, DMA_TO_DEVICE); - - return 0; } static const struct dev_pm_ops bam_dmux_pm_ops = { @@ -893,7 +891,7 @@ MODULE_DEVICE_TABLE(of, bam_dmux_of_match); static struct platform_driver bam_dmux_driver = { .probe = bam_dmux_probe, - .remove = bam_dmux_remove, + .remove_new = bam_dmux_remove, .driver = { .name = "bam-dmux", .pm = &bam_dmux_pm_ops, From patchwork Mon Dec 4 18:30: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: 13478923 X-Patchwork-Delegate: kuba@kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3E49AF for ; Mon, 4 Dec 2023 10:31:37 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rADj4-0003EH-OW; Mon, 04 Dec 2023 19:31:26 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rADj4-00DZmu-Ae; Mon, 04 Dec 2023 19:31:26 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rADj4-00EE7o-1D; Mon, 04 Dec 2023 19:31:26 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alexander Aring , Stefan Schmidt , Miquel Raynal , linux-wpan@vger.kernel.org, netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next v2 8/9] ieee802154: fakelb: Convert to platform remove callback returning void Date: Mon, 4 Dec 2023 19:30:48 +0100 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: 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=1921; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=VKch1ipn7t8ZInXZC+JnFjON308+uqyTcVJMg2wIeM8=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbhrmwJOkHywfcmrDcxQWT339/zMTPTD/SY/Ke QjXCz4e5dWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZW4a5gAKCRCPgPtYfRL+ TsV7CACYnV6EbdFEaM+ItV2iYgTAbMMT6CZWp9HsqAcJNbcUEBij5A44OBGQ8D0LgDwu05RkN4k OW1kcaPSEDuQxfIatMcMGm/RnIMbwPIR0pYA40eq+9ZKmzrFqcetwKwS/BRs8iJkHXQtMSwDmW8 4LnuZiz6+N4EE3cdqJWaICNaLjgJw9THxK+Tgv0Cx/19DiYgAfPVXL0JmvrSXPAO31mHyHOs1FZ ZVNoa/qWzQfoCooqhKtuRxbXbMuyKvUe1a967Btff4BfKarohbv1PIO2Nm8Vcdeu1knETtxq8zF 5eO55GqY/9dgM+BEUJuSMdZ44fEKTlslEEpqX4gB+xlP49t0 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: 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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Acked-by: Stefan Schmidt Link: https://lore.kernel.org/r/20231117095922.876489-10-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König --- drivers/net/ieee802154/fakelb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ieee802154/fakelb.c b/drivers/net/ieee802154/fakelb.c index 523d13ee02bf..35e55f198e05 100644 --- a/drivers/net/ieee802154/fakelb.c +++ b/drivers/net/ieee802154/fakelb.c @@ -221,7 +221,7 @@ static int fakelb_probe(struct platform_device *pdev) return err; } -static int fakelb_remove(struct platform_device *pdev) +static void fakelb_remove(struct platform_device *pdev) { struct fakelb_phy *phy, *tmp; @@ -229,14 +229,13 @@ static int fakelb_remove(struct platform_device *pdev) list_for_each_entry_safe(phy, tmp, &fakelb_phys, list) fakelb_del(phy); mutex_unlock(&fakelb_phys_lock); - return 0; } static struct platform_device *ieee802154fake_dev; static struct platform_driver ieee802154fake_driver = { .probe = fakelb_probe, - .remove = fakelb_remove, + .remove_new = fakelb_remove, .driver = { .name = "ieee802154fakelb", }, From patchwork Mon Dec 4 18:30: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: 13478924 X-Patchwork-Delegate: kuba@kernel.org Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0705F119 for ; Mon, 4 Dec 2023 10:31:38 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rADj4-0003Ex-Up; Mon, 04 Dec 2023 19:31:26 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rADj4-00DZmx-GY; Mon, 04 Dec 2023 19:31:26 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rADj4-00EE7r-7B; Mon, 04 Dec 2023 19:31:26 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Alexander Aring , Stefan Schmidt , Miquel Raynal , linux-wpan@vger.kernel.org, netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next v2 9/9] ieee802154: hwsim: Convert to platform remove callback returning void Date: Mon, 4 Dec 2023 19:30:49 +0100 Message-ID: <29b9d8edea7bc03d9726253afcc7259d4dd5d431.1701713943.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: 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=1906; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=C0ftBvvArAEACL2sNAQ3DQ2N8lu4DJJST9N+PNpK0YY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbhrpAfo+Ey/oKNme5QtDMIBIZNARHKvIiADJZ gxujNE74d2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZW4a6QAKCRCPgPtYfRL+ ThIMB/9PonopCsA6WMmgplNNDhzAM4byiT+LgjISMi175umw8zTQjvG2MGRqfZK3530xSZeBuae u+h3n4tQGbO203KsJJz0CEs4260Q2rwZbUi9GLWnMHRnWj9hZOKzgTHZ6QDRoCQgUmHsHNkGV3h SS+K2LHlQdY465kp2CJzvbztLV4nnBrCli59sNBNDl3O+4k1nPVc+2u76ElO1FCWhm+2ilm+iAO 8RyUZNiaCXNK/c/YYGd4sp07M3TBfUR15g392JJ1mwgWaGrNdCOwuyfh/0t+NhbCR3kUgTKYy5J Ic0dD7+OwEqrQEu5tG2EUjDsR6M/nR3fWOaqdxszYv1HmeCO 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: 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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Acked-by: Stefan Schmidt Link: https://lore.kernel.org/r/20231117095922.876489-11-u.kleine-koenig@pengutronix.de Signed-off-by: Uwe Kleine-König --- drivers/net/ieee802154/mac802154_hwsim.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c index 31cba9aa7636..2c2483bbe780 100644 --- a/drivers/net/ieee802154/mac802154_hwsim.c +++ b/drivers/net/ieee802154/mac802154_hwsim.c @@ -1035,7 +1035,7 @@ static int hwsim_probe(struct platform_device *pdev) return err; } -static int hwsim_remove(struct platform_device *pdev) +static void hwsim_remove(struct platform_device *pdev) { struct hwsim_phy *phy, *tmp; @@ -1043,13 +1043,11 @@ static int hwsim_remove(struct platform_device *pdev) list_for_each_entry_safe(phy, tmp, &hwsim_phys, list) hwsim_del(phy); mutex_unlock(&hwsim_phys_lock); - - return 0; } static struct platform_driver mac802154hwsim_driver = { .probe = hwsim_probe, - .remove = hwsim_remove, + .remove_new = hwsim_remove, .driver = { .name = "mac802154_hwsim", },