From patchwork Fri Nov 17 09:59:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13458711 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=none 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 BFB0BA7 for ; Fri, 17 Nov 2023 01:59:54 -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 1r3vdb-0000Ca-I9; Fri, 17 Nov 2023 10:59:47 +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 1r3vda-009eFb-Ri; Fri, 17 Nov 2023 10:59:46 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r3vda-002zVr-Ia; Fri, 17 Nov 2023 10:59:46 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Alex Elder , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next 01/10] net: ipa: Don't error out in .remove() Date: Fri, 17 Nov 2023 10:59:24 +0100 Message-ID: <20231117095922.876489-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231117095922.876489-1-u.kleine-koenig@pengutronix.de> References: <20231117095922.876489-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=1141; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=ByYbLET6ybS3EL2khqi5VvFTgeu+iTZlHH25mHWO8/Y=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlVzl8uXxZfoXgg/MLTQ1uFyi8IcPpWUqMzPWMk aNc+NPGo6WJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZVc5fAAKCRCPgPtYfRL+ TjztCACCUZz2DEv7GVcGNO81ONCZc3J7vxjcZB/tuLU+rrluJrqq4HHoa4D5wBpHHxjY1klrfV6 3GpkVjyY1euZaiJv/1getrTclhQsc3woIH+SdmzKIxgF3VZiSIjRidGb584N9gcrIrnQV+bFcev vMrmwortFjplQ5ptQ3d2OZjLBPuJj1Sy6mS7c3GlUhpUvWi5gzs7cOT1/8+VfLqBrDZLQ0x6VC1 XrEiccShKVDmT8bYuqLUuhtjGIvBlXTgSHek3qCW+dKv0xhmwNflgxPGIf2XX0cumB5eJJDUKIz L/EtaLWMe05sUc9my72OwKU01CJ3J27lk09vMUVG61SEwbjF 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 Returning early from .remove() with an error code still results in the driver unbinding the device. So the driver core ignores the returned error code and the resources that were not freed are never catched up. In combination with devm this also often results in use-after-free bugs. Here even if the modem cannot be stopped, resources must be freed. So replace the early error return by an error message an continue to clean up. This prepares changing ipa_remove() to return void. Fixes: cdf2e9419dd9 ("soc: qcom: ipa: main code") Signed-off-by: Uwe Kleine-König --- drivers/net/ipa/ipa_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index da853353a5c7..60e4f590f5de 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -960,7 +960,8 @@ static int ipa_remove(struct platform_device *pdev) ret = ipa_modem_stop(ipa); } if (ret) - return ret; + dev_err(dev, "Failed to stop modem (%pe)\n", + ERR_PTR(ret)); ipa_teardown(ipa); } From patchwork Fri Nov 17 09:59:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13458709 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=none 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 419D584 for ; Fri, 17 Nov 2023 01:59:54 -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 1r3vdb-0000Cb-IB; Fri, 17 Nov 2023 10:59:47 +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 1r3vdb-009eFe-2c; Fri, 17 Nov 2023 10:59:47 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r3vda-002zVv-Pm; Fri, 17 Nov 2023 10:59:46 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Alex Elder , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next 02/10] net: ipa: Convert to platform remove callback returning void Date: Fri, 17 Nov 2023 10:59:25 +0100 Message-ID: <20231117095922.876489-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231117095922.876489-1-u.kleine-koenig@pengutronix.de> References: <20231117095922.876489-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=2094; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=UR+v83JWKRrfwt67dn6LJcB789pXVB0wn22BwbFd2+8=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlVzl9YU33CM2Es8FE3kX6iVcCgtuYpWiT+I9xA WInnog9/AKJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZVc5fQAKCRCPgPtYfRL+ TgAkB/sGtQWgnFy7aBlAT+ZhNVWulBFFwOAOUnXCE76bf8/uBH3UmAbLznc3A/5Xfji6beK0k4s 77QUJBsCrK7um9g7KRJ5nLH1Cy8XQycYua60e7VMZ3vDXau2v4rn5Zv2y6Kb4nCGBVZBoWtbzj/ /NIkt8aJXURcYBQka0Ii49RKym0pwXFUOMoMj9+jT8Yx1jqmJUT/2zpF+Bi8gPesKVputq4qxK6 o+mPNDqP6n7l17ApK8ODoBLHGe1GZtkJhNop/GIC4vfU6+duKpy+F++pNOwALFx/jMqHm6z+ItD uAS7g/C+B/ZPSLUdtY+hUnhKIozYEFzbNgX/hA4K8NEWYKXw 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. Signed-off-by: Uwe Kleine-König --- drivers/net/ipa/ipa_main.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 60e4f590f5de..2c769b85a2cd 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -936,7 +936,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; @@ -979,17 +979,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[] = { @@ -1002,8 +991,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 Fri Nov 17 09:59:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13458716 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=none 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 32F10B0 for ; Fri, 17 Nov 2023 01:59:59 -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 1r3vdc-0000Cc-9w; Fri, 17 Nov 2023 10:59:48 +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 1r3vdb-009eFh-A4; Fri, 17 Nov 2023 10:59:47 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r3vdb-002zVz-0S; Fri, 17 Nov 2023 10:59:47 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Rafael J. Wysocki" , Dmitry Torokhov , Tariq Toukan , Christian Marangi , Dawei Li Cc: netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next 03/10] net: fjes: Convert to platform remove callback returning void Date: Fri, 17 Nov 2023 10:59:26 +0100 Message-ID: <20231117095922.876489-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231117095922.876489-1-u.kleine-koenig@pengutronix.de> References: <20231117095922.876489-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=1837; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=pz7UYK1tnAUTXNX0xhss9QTvMQ+xahN+AfbQOiDS1Qk=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlVzl+pweqfFiPpTKUwuX441ZTXCsqLedvDs/Yj V87hTNNYvyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZVc5fgAKCRCPgPtYfRL+ Ti5LB/9AZT99rHDbHUSUjqvbgbggSNXC0d8TyDyVPo4oB8TDjt138P6iMf0Jm0r1FPNzHGnkIbz cgpIFIq0hr6IVLsn8WNGDFktxk64VWpU0J2GjQOoObbIkSMGdAwVa08cQJ+W59WyZ+QfRqcbqwx /EY3IgZj8XiyeiXE3gDxfzaBNoCek/u76irHz+z6/Nezhf6eKes1RjEzxMkbnEY8BpatN3Ja/Cq 5la7Zap+hnecwNXnk/tKXnMP3oCtaBkwqJTS8/2O1h6MOamrrQLPsIVCIkgvukCIr5tq274fILl EE4gLeKo1UyKhFeQGsFAz7wlXGKusiVBRZZeN+AYDFyMvcdz 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. 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 Fri Nov 17 09:59:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13458714 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=none 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 94939C1 for ; Fri, 17 Nov 2023 01:59:59 -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 1r3vdc-0000Cv-9c; Fri, 17 Nov 2023 10:59:48 +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 1r3vdb-009eFk-Km; Fri, 17 Nov 2023 10:59:47 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r3vdb-002zW3-BC; Fri, 17 Nov 2023 10:59:47 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: =?utf-8?b?Q2zDqW1lbnQgTMOpZ2Vy?= , Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Russell King , linux-renesas-soc@vger.kernel.org, netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next 04/10] net: pcs: rzn1-miic: Convert to platform remove callback returning void Date: Fri, 17 Nov 2023 10:59:27 +0100 Message-ID: <20231117095922.876489-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231117095922.876489-1-u.kleine-koenig@pengutronix.de> References: <20231117095922.876489-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=1619; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=Lz7tUUn8eW/6NCcaxKNY5iWuUPDkoUM+e6kcay8ikz8=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlVzl/WQWllQ3FE1DQmW5liysNkRx63mxlc37PF 4wFaaRbqcmJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZVc5fwAKCRCPgPtYfRL+ Ts6YCACNWuOngwvtkSGhR7t2Q7eFmZ8/QI6gXu5p3TS8Su/MzrQIXjfYcV3XMCaqM1cOH7RGMrq TxLogqADW3/qKbp+srvIt1gGPgBQ7lq2Fvk977+lHPn+SlXmapvjFN0id5JrVPPBsyhH8BWpf49 bhwtwOZVJOUPQX0zpwwJkYZi/CoUHcK0z2Wr1U+d4L1mFOTY7r5iNcV7g6mrwtV5B1LBrSuWza9 xRJLh6n5+p2RsiL5uQoP0aMysrUUdEm07Zhu/H2OzWOnNeKi1VFbXSdKtDlprU61DohYrEwNLby cUfK/KnF/wmFoETsN5vFQM5haBl5pZhFcBBdtmRDXF2hjH1M 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. Signed-off-by: Uwe Kleine-König Reviewed-by: Geert Uytterhoeven --- 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 Fri Nov 17 09:59:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13458712 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=none 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 1AC8AA9 for ; Fri, 17 Nov 2023 01:59:56 -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 1r3vdc-0000Cw-A1; Fri, 17 Nov 2023 10:59:48 +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 1r3vdb-009eFp-Ra; Fri, 17 Nov 2023 10:59:47 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r3vdb-002zWC-II; Fri, 17 Nov 2023 10:59:47 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Russell King , Andrew Lunn , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next 05/10] net: sfp: Convert to platform remove callback returning void Date: Fri, 17 Nov 2023 10:59:28 +0100 Message-ID: <20231117095922.876489-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231117095922.876489-1-u.kleine-koenig@pengutronix.de> References: <20231117095922.876489-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=1762; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=6b1/r3nohYrC/70zxlL2kNntlccPvHvYfH1SCl9wYnk=; b=owGbwMvMwMXY3/A7olbonx/jabUkhtRwy4bwsK+9BS1FH9/paXnyqJwN0rzUHNP+68yP6enfv QMyeMs7GY1ZGBi5GGTFFFnsG9dkWlXJRXau/XcZZhArE8gUBi5OAZiIrS37P5N1dxvC1m5Ry/MX 3OaY4xE+a7LLP3fN236hTI/9NBdGTTH7M1foQdnswP28HbIqJ/U6lr3lYwnbaPmfX/bAxe5YKzf D3cmFdsVsCtmLLmr6m7su/8awOmQud/gBjfJtW09vu2P/4sbKT/bTZgbt3Xo5T+yghOCnggU3Qo 8ZB4Y6egUKOLgtsVx3VTI4plfz/enjn4wnPzhi/jN94sInpmuCZqRPW8f3c1qpQOjCaw6H21iZv V/85Np/lUtfMEXMIcdscmFXd+I2qVlFH1zCaj7VVt76fODg04uqS8vb2CuOGbdOsolZ6GYu+/DF 94jIz6deNYqyFDmpiXncKnB4y1pd0t2qXniCk80g3akXAA== 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. 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 5468bd209fab..859b4749e8e2 100644 --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c @@ -3096,7 +3096,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); @@ -3106,8 +3106,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) @@ -3128,7 +3126,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 Fri Nov 17 09:59:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13458710 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=none 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 514B185 for ; Fri, 17 Nov 2023 01:59:54 -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 1r3vdd-0000DT-3D; Fri, 17 Nov 2023 10:59:49 +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 1r3vdc-009eFs-48; Fri, 17 Nov 2023 10:59:48 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r3vdb-002zWG-RA; Fri, 17 Nov 2023 10:59:47 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Zhao Qiang , "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 06/10] net: wan/fsl_ucc_hdlc: Convert to platform remove callback returning void Date: Fri, 17 Nov 2023 10:59:29 +0100 Message-ID: <20231117095922.876489-7-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231117095922.876489-1-u.kleine-koenig@pengutronix.de> References: <20231117095922.876489-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=1871; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=NcjkW4IneIOd0dLZTdAVWdaFwPL7kTl1fdfEPCD9h5I=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlVzmBIBQWc3YwrHGUgl1NVC071q+J3xqj1LQj9 OBZHa0ZmN2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZVc5gQAKCRCPgPtYfRL+ Tsw+CAChcjHP+6yzxRri4q0G7oSZfAo0onlNYcorEcXtoIGeDwvEG7p0U4jr4HMunXrIW+Puc4W MBQXqVtK9P+Y53I3/5NRxeKIncunGSW/sK3r7Nx9Bc0IoVP5obik0M0wHUhMu9HtB8EApBcICqw r4Wu2D2NYlV6Ctuqny1pT1U+oCDeaFG1gyf0TO17muS8jqeEImDLfaSpGBIoePDivBtb95xCzSh moZme9sFnUlOV7WoRmLCUGOv+BlLwSuWlsTe3sr64c3c8Q4faSV3Fnqw1dEUBYi8RMyBtDAa0p2 GxmObJMk9eAG6wxOcQPqy6RXxZOKMHjV9XSQzi0cfL+t0Xf+ 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. 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 Fri Nov 17 09:59:30 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: 13458713 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=none 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 78B1D85 for ; Fri, 17 Nov 2023 01:59:57 -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 1r3vdc-0000F3-UP; Fri, 17 Nov 2023 10:59:48 +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 1r3vdc-009eFv-B9; Fri, 17 Nov 2023 10:59:48 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r3vdc-002zWK-22; Fri, 17 Nov 2023 10:59:48 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Linus Walleij , Imre Kaloz , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next 07/10] net: wan/ixp4xx_hss: Convert to platform remove callback returning void Date: Fri, 17 Nov 2023 10:59:30 +0100 Message-ID: <20231117095922.876489-8-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231117095922.876489-1-u.kleine-koenig@pengutronix.de> References: <20231117095922.876489-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=1683; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=imcM2zPwOV8/aLvSFu/FCWca9j4c+gKvqqz0ToArDKE=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlVzmDmzbqh2Uq1Mj6vs5HB95nEU8p2R0zHyLWM TfaQIH4m2eJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZVc5gwAKCRCPgPtYfRL+ TuZiB/90rLadLTRDwDEKpCkZ+7l5WKvUQZrg7oJR0ssc/ZL8pAGnAf2a10ErBAyLsLdWRTwGZfw A2TKyE/c3F3zidg0B4yDgQgGNP3oErlO6fSHo/8zO3MsgJfmZKnvcfL/LGObLUvJfz587xq/6bc GwQPvnk+fM7uhh8EeEgmEj3s9EDJ1Tdvgu1rzi495ie7B8MgHDbb+6tNFCXv3FBSpSp1dtVazzX Ms2qGLg4aOlYDA8NKopDBhIzhp21wm02TzaTbvANyHLIurZg8IEcJwOciCvfEI1ybJIvAasImU1 RVM0ghCkkhbkpUnvxzuIZiRbLFlW8qMssM8mWddsdrU4AYRS 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. Signed-off-by: Uwe Kleine-König --- 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 Fri Nov 17 09:59:31 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: 13458715 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=none 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 23E15A9 for ; Fri, 17 Nov 2023 01:59:59 -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 1r3vdd-0000Fw-8e; Fri, 17 Nov 2023 10:59:49 +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 1r3vdc-009eG1-Kc; Fri, 17 Nov 2023 10:59:48 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r3vdc-002zWO-BD; Fri, 17 Nov 2023 10:59:48 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Stephan Gerhold , Andy Gross , Bjorn Andersson , Konrad Dybcio , Loic Poulain , Sergey Ryazanov , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Johannes Berg , netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next 08/10] net: wwan: qcom_bam_dmux: Convert to platform remove callback returning void Date: Fri, 17 Nov 2023 10:59:31 +0100 Message-ID: <20231117095922.876489-9-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231117095922.876489-1-u.kleine-koenig@pengutronix.de> References: <20231117095922.876489-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=1920; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=I0cFjEm08r7Sa/vJ9WgcsZdF39eVvWjUnKoRRtwRSOg=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlVzmEF/OglZ9axYPnAwVofQSX2s3BG0bx/dQ2C +QUMAS/wAqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZVc5hAAKCRCPgPtYfRL+ TouEB/9UOKFB8rasl8PENTAGL+VL177GVGlYnmOhAoiYStSVjlTgo2IDJWWEYzwtzXgTMmnC1ZB 7CL8ZNwHmRY5YaJzEqJ2aSkSCkarmKBp2qYGf58S2U89jKys38QcWHW9CbSec1fyanx0O8nwvf+ V0Qbl5B5XXJKb8P74JXK+O2KUg8b1bPhZp1NfltRZd62v1SsknP8EaoYqGf3kzuLCxTLJtCmS5J RTv3QF1GzN9udDDkjhMLbjlaqvQXyGmKUBWi7A1TeR606YFh3ai7znmfsPVn337tQ3Xbxs1IhlE j78kBIiIEoqLI1fZhrAlg5TFs6skoUFtBxMlWs0A/HWpV58u 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. Signed-off-by: Uwe Kleine-König Reviewed-by: Sergey Ryazanov --- 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 Fri Nov 17 09:59:32 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: 13458718 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=none 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 4EE1C84 for ; Fri, 17 Nov 2023 02:00:00 -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 1r3vdd-0000HS-A4; Fri, 17 Nov 2023 10:59:49 +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 1r3vdc-009eG4-RG; Fri, 17 Nov 2023 10:59:48 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r3vdc-002zWS-I9; Fri, 17 Nov 2023 10:59:48 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Alexander Aring , Stefan Schmidt , Miquel Raynal , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next 09/10] ieee802154: fakelb: Convert to platform remove callback returning void Date: Fri, 17 Nov 2023 10:59:32 +0100 Message-ID: <20231117095922.876489-10-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231117095922.876489-1-u.kleine-koenig@pengutronix.de> References: <20231117095922.876489-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=1778; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=bW8hRXr41lIHBTT37J3wUaNIhd6NGJvlV2f3mSrYWnQ=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlVzmF/y5+oroMLNKD1jt7neq6OH+mkdMueiR18 t8eMMZCe+OJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZVc5hQAKCRCPgPtYfRL+ TsDaCACeRO6UhsdRRppzB6k1yO41zwHlacry8lc2ssMarKdztr/lM5gTp8ANYI5VWKTU7233jZS xdw1NCXbLHYu/VwwmrCNnSh6BQy8AOAcVNRC+62ZBN43R1LHGxoSilIBbbpxoZL9kCuuu7p+f6N R55DH0xXmTsbLVFzssC/CXc3/SER6TwCmlFUPawWEiguPLjz6TX9LLBWd8wffyAvkQZHSfZiSIR MqLPE6ODgqq+59TYlMVAno+I5A9j5dcjPGSnD9ebULmsFioms+lBWZYaxLdLM5B1sSnQTUIop6/ BSES++UHkbdiBZz1YYao9j8m7PQuTD4dicaX+zWXdT3X9Nle 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. Signed-off-by: Uwe Kleine-König Acked-by: Stefan Schmidt --- 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 Fri Nov 17 09:59:33 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: 13458717 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=none 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 49D87AD for ; Fri, 17 Nov 2023 02:00:01 -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 1r3vdd-0000JE-JR; Fri, 17 Nov 2023 10:59:49 +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 1r3vdd-009eG8-5V; Fri, 17 Nov 2023 10:59:49 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r3vdc-002zWW-Sc; Fri, 17 Nov 2023 10:59:48 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Alexander Aring , Stefan Schmidt , Miquel Raynal , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: linux-wpan@vger.kernel.org, netdev@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH net-next 10/10] ieee802154: hwsim: Convert to platform remove callback returning void Date: Fri, 17 Nov 2023 10:59:33 +0100 Message-ID: <20231117095922.876489-11-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0.586.gbc5204569f7d.dirty In-Reply-To: <20231117095922.876489-1-u.kleine-koenig@pengutronix.de> References: <20231117095922.876489-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=1763; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=OySE8VQ225pwhwuZLy68C4sg5i3fP0VIUcSiYfkzQmE=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlVzmGfTaQbU/uL7NMdAV08B2HUVvhb4053Ecsa AnNjSiz5ZmJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZVc5hgAKCRCPgPtYfRL+ Trv/B/4rMgdZ1dP5QFXvp03L1vFtdVKJHccFaLyyR3o9F1YozR90WlSousX8KuoXq/iErzfA5Mh 4/bB1n4E+jvyOgq643wW4D+6r6aNJk5Pa0T7nGci9RhLpcbZo+CJFtCOWiASrydwLkMStPidqTN 9rcDLo00tY2wP8OlP82sFRYI+axYUASqiLimKZlOP431xej0gH/NGcZKieDSMc3imBuZBNYKesv CfxUTYLG36V9i9Fhton8CiD/FYbdfNAym8F8LPPhey7NCuvOIwGXlQFZpHnZRHMrV5xyWPWsc7D B+MYvVq/ONyZMv+3AfYD9F9OcYd6Hjd950kE5sofdHFwAaQg 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. Signed-off-by: Uwe Kleine-König Acked-by: Stefan Schmidt --- 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", },