From patchwork Wed Apr 5 14:10:00 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: 13201818 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 504DFC7619A for ; Wed, 5 Apr 2023 14:11:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238145AbjDEOLN (ORCPT ); Wed, 5 Apr 2023 10:11:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232562AbjDEOKr (ORCPT ); Wed, 5 Apr 2023 10:10:47 -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 758443595 for ; Wed, 5 Apr 2023 07:10:19 -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 1pk3q4-0003FD-W1; Wed, 05 Apr 2023 16:10:17 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pk3q3-009Abb-Ry; Wed, 05 Apr 2023 16:10:15 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pk3q2-00AmTm-PP; Wed, 05 Apr 2023 16:10:14 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Bin Liu , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 01/10] usb: musb: da8xx: Convert to platform remove callback returning void Date: Wed, 5 Apr 2023 16:10:00 +0200 Message-Id: <20230405141009.3400693-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> References: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1589; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=9aNEuY5OUAI+bGd77FghSJhGtgSDG4h2uQbuqPjqi3A=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkLYEx2P9s6ehdU4JQPG6/dgqSVIXmMWp5C83xt LpcyQEBlOOJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZC2BMQAKCRCPgPtYfRL+ TlG+B/0Sqts44CAEbUr+SeVXq/1yBCZut1rIkHkK+ZtjHSQYdgpCSLpyCAjg9t1h97UBkSRxPt7 ls5NdFMms+/OdYNnj27f6tQnwBOfTgAqn2QYTIQgB3wG9GGGu5SKa3xW3Rn5RZDK3Mln+hzsvH8 KC8gYwdRuLzoai5wGTrXIoNusg6p2mjUcPnOwasCLi7ET7lDzW17Wfyx7l5zL20QIiZXs4bvmlz af8C5EZificSCVlDaATMYXibMkk4+aa7IYEKd9cm9b/poR1OOhx3awW28KnzX1OXReo3CQcqa36 /gD1TFWHTNlgI/+DYZvlCyRsJ/4F+5b7Ffrx6yHGgW2AniDf 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: linux-usb@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.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/usb/musb/da8xx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index d47e5c94587b..912e32b78ac6 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -576,14 +576,12 @@ static int da8xx_probe(struct platform_device *pdev) return ret; } -static int da8xx_remove(struct platform_device *pdev) +static void da8xx_remove(struct platform_device *pdev) { struct da8xx_glue *glue = platform_get_drvdata(pdev); platform_device_unregister(glue->musb); usb_phy_generic_unregister(glue->usb_phy); - - return 0; } #ifdef CONFIG_PM_SLEEP @@ -626,7 +624,7 @@ MODULE_DEVICE_TABLE(of, da8xx_id_table); static struct platform_driver da8xx_driver = { .probe = da8xx_probe, - .remove = da8xx_remove, + .remove_new = da8xx_remove, .driver = { .name = "musb-da8xx", .pm = &da8xx_pm_ops, From patchwork Wed Apr 5 14:10:01 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: 13201825 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 42DD4C76188 for ; Wed, 5 Apr 2023 14:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238401AbjDEOLY (ORCPT ); Wed, 5 Apr 2023 10:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238287AbjDEOKy (ORCPT ); Wed, 5 Apr 2023 10:10:54 -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 5832361BA for ; Wed, 5 Apr 2023 07:10:24 -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 1pk3q4-0003FF-W1; Wed, 05 Apr 2023 16:10:17 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pk3q3-009Abf-Ve; Wed, 05 Apr 2023 16:10:15 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pk3q2-00AmTp-Vv; Wed, 05 Apr 2023 16:10:15 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Paul Cercueil , Bin Liu , Greg Kroah-Hartman Cc: linux-mips@vger.kernel.org, linux-usb@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 02/10] usb: musb: jz4740: Convert to platform remove callback returning void Date: Wed, 5 Apr 2023 16:10:01 +0200 Message-Id: <20230405141009.3400693-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> References: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1655; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=LInJ1VCltnR5zQZF3u3QFfDFUTQVLF2/3mjdDDUK2yk=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkLYEyTrllnyAk+4A0JArG+9Z/8Sf3w+R94F9Np ubxA2IrkuiJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZC2BMgAKCRCPgPtYfRL+ TjL3B/9f8A8Z7sDaUMrpsotRlJ7ybY+bjEYSC1gxqkgn4tREYbIL1JbtbPZWL/TpGStVeFj5cMr 0odUsl8fFZCjUekBIrcoTyh8L01dd5OgNaK8984RFHipQs9cpN1F/akKcrxZwyWe2CAtxqd3MHg t9QO++Kc8bX2u4oiQlsEbC7kulRlOCUSZrAYFa0LV1UqUNi+Ii0cR2qj0DwekW9bcbkwyQdxSfq AYmp5OkU/BIKhto8XMg3n1dKD1TN4oSw/LWkCApRVpJ74V+FKz4xYLGyLBNznAIeWvoMnFcvS39 kTXzmrmau+fHdXFuyaIyyYTxx4eD6HiN2vOyiT5/3fPSbn9o 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: linux-usb@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.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 Reviewed-by: Paul Cercueil Reviewed-by: Philippe Mathieu-Daudé --- drivers/usb/musb/jz4740.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c index c7b1d2a394d9..5aabdd7e2511 100644 --- a/drivers/usb/musb/jz4740.c +++ b/drivers/usb/musb/jz4740.c @@ -308,14 +308,12 @@ static int jz4740_probe(struct platform_device *pdev) return ret; } -static int jz4740_remove(struct platform_device *pdev) +static void jz4740_remove(struct platform_device *pdev) { struct jz4740_glue *glue = platform_get_drvdata(pdev); platform_device_unregister(glue->pdev); clk_disable_unprepare(glue->clk); - - return 0; } static const struct of_device_id jz4740_musb_of_match[] = { @@ -327,7 +325,7 @@ MODULE_DEVICE_TABLE(of, jz4740_musb_of_match); static struct platform_driver jz4740_driver = { .probe = jz4740_probe, - .remove = jz4740_remove, + .remove_new = jz4740_remove, .driver = { .name = "musb-jz4740", .of_match_table = jz4740_musb_of_match, From patchwork Wed Apr 5 14:10:02 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: 13201823 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 45965C77B70 for ; Wed, 5 Apr 2023 14:11:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238542AbjDEOLU (ORCPT ); Wed, 5 Apr 2023 10:11:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238216AbjDEOKx (ORCPT ); Wed, 5 Apr 2023 10:10:53 -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 D55A66199 for ; Wed, 5 Apr 2023 07:10:22 -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 1pk3q5-0003FL-CT; Wed, 05 Apr 2023 16:10:17 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pk3q4-009Abi-22; Wed, 05 Apr 2023 16:10:16 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pk3q3-00AmTs-6L; Wed, 05 Apr 2023 16:10:15 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Bin Liu , Greg Kroah-Hartman , Matthias Brugger Cc: AngeloGioacchino Del Regno , linux-usb@vger.kernel.org, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH 03/10] usb: musb: mediatek: Convert to platform remove callback returning void Date: Wed, 5 Apr 2023 16:10:02 +0200 Message-Id: <20230405141009.3400693-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> References: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1695; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=RpBOv6m49AgJI769GPZjDwdUzESQIC9qonvn+da5A/s=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkLYEzpMOGbs9KBOBr5kn2pH+FguaJosWzOto9s jr3Tlrrw82JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZC2BMwAKCRCPgPtYfRL+ Tq41B/9KraWDsU5Ja74j/Vj8MPqnoaFBhUlN41PKb5uH5F7L1YWuy5Mqk+NkwkVuZpmDfgUpM1N QwCjdvjsLK/FI9L2ogBFtKOTz0XplT5UswbDjI4Z4L/MMtlaA2/OOc2VsmesPLEpaXw6upuATqw wM2wuoXT5rTYBYd+5Jw59ybXkRTfiSv7mOP3Ny6417pva1zb9haYU1Z6Br6PxKOHxfBQb2trssk QPLG3oG4OpAkq6x67Hz/FiYdfE/Hg3vNAAKQQ0W6r9BeAr7Gz2t3xBbVWu5z6FaFdEFD5iRRRGs xFs+bQ1QK/MDmBbdDy0nJA0svEtSdmpy39p9HtjdxtuKXv7B 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: linux-usb@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.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/usb/musb/mediatek.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/musb/mediatek.c b/drivers/usb/musb/mediatek.c index 27b9bd258340..598ee5c0bf34 100644 --- a/drivers/usb/musb/mediatek.c +++ b/drivers/usb/musb/mediatek.c @@ -508,15 +508,13 @@ static int mtk_musb_probe(struct platform_device *pdev) return ret; } -static int mtk_musb_remove(struct platform_device *pdev) +static void mtk_musb_remove(struct platform_device *pdev) { struct mtk_glue *glue = platform_get_drvdata(pdev); struct platform_device *usb_phy = glue->usb_phy; platform_device_unregister(glue->musb_pdev); usb_phy_generic_unregister(usb_phy); - - return 0; } #ifdef CONFIG_OF @@ -529,7 +527,7 @@ MODULE_DEVICE_TABLE(of, mtk_musb_match); static struct platform_driver mtk_musb_driver = { .probe = mtk_musb_probe, - .remove = mtk_musb_remove, + .remove_new = mtk_musb_remove, .driver = { .name = "musb-mtk", .of_match_table = of_match_ptr(mtk_musb_match), From patchwork Wed Apr 5 14:10:03 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: 13201827 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 98FD4C76188 for ; Wed, 5 Apr 2023 14:11:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238483AbjDEOL3 (ORCPT ); Wed, 5 Apr 2023 10:11:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238481AbjDEOLC (ORCPT ); Wed, 5 Apr 2023 10:11:02 -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 5B00461B8 for ; Wed, 5 Apr 2023 07:10:33 -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 1pk3q5-0003FN-2p; Wed, 05 Apr 2023 16:10:17 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pk3q4-009Abm-57; Wed, 05 Apr 2023 16:10:16 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pk3q3-00AmTv-DA; Wed, 05 Apr 2023 16:10:15 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Conor Dooley , Daire McNamara , Bin Liu , Greg Kroah-Hartman Cc: linux-riscv@lists.infradead.org, linux-usb@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 04/10] usb: musb: mpfs: Convert to platform remove callback returning void Date: Wed, 5 Apr 2023 16:10:03 +0200 Message-Id: <20230405141009.3400693-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> References: <20230405141009.3400693-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=33gaBA4Y6a4NaItjwqP6ZDVvbHUivrlSDU1JTOlXqYo=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkLYE0cAo6wW2W/ZfnRAyWEZgKaGnL27Sw/5V1a LwcHR5o0XWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZC2BNAAKCRCPgPtYfRL+ TloSCACUkxuwkt7CPpgYZVAcJzKsyqRMZO+aTxnp616JRovzeEwiFsPb+C4pFnc+NSBISz3IIx/ yMr193y0Oji9VxGuiPzrJTR0iyHHgkfmt6E2drYrn2rKhIpGNE2/luuWcqUDuLX4nIPiOSKBl0G SzrIa9PXzc4KsIND0i6xATDxPHjB4ZRnodvJj254eyO+xUlDf2gO+RFlY3nsz9RYMPlNAXwQVz+ ClFoETrLnGGduLle/ZMzGhbJozjo2MbjoJPwiy5Ujv2q0gUT2aKhICo4wkPxO5pM6as8+G2w2WP QJkmGjMYlTIqpI6FYMxQacYLEYS9XRTldpPcHq6+H7L2kiTJ 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: linux-usb@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.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 Reviewed-by: Conor Dooley --- drivers/usb/musb/mpfs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/musb/mpfs.c b/drivers/usb/musb/mpfs.c index cea2e8108867..24b98716f7fc 100644 --- a/drivers/usb/musb/mpfs.c +++ b/drivers/usb/musb/mpfs.c @@ -235,15 +235,13 @@ static int mpfs_probe(struct platform_device *pdev) return ret; } -static int mpfs_remove(struct platform_device *pdev) +static void mpfs_remove(struct platform_device *pdev) { struct mpfs_glue *glue = platform_get_drvdata(pdev); clk_disable_unprepare(glue->clk); platform_device_unregister(glue->musb); usb_phy_generic_unregister(pdev); - - return 0; } #ifdef CONFIG_OF @@ -256,7 +254,7 @@ MODULE_DEVICE_TABLE(of, mpfs_id_table); static struct platform_driver mpfs_musb_driver = { .probe = mpfs_probe, - .remove = mpfs_remove, + .remove_new = mpfs_remove, .driver = { .name = "mpfs-musb", .of_match_table = of_match_ptr(mpfs_id_table) From patchwork Wed Apr 5 14:10:04 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: 13201820 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 D4D20C761A6 for ; Wed, 5 Apr 2023 14:11:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238195AbjDEOLQ (ORCPT ); Wed, 5 Apr 2023 10:11:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238512AbjDEOKr (ORCPT ); Wed, 5 Apr 2023 10:10:47 -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 F40DD6EAB for ; Wed, 5 Apr 2023 07:10:19 -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 1pk3q5-0003FS-64; Wed, 05 Apr 2023 16:10:17 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pk3q4-009Abr-I2; Wed, 05 Apr 2023 16:10:16 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pk3q3-00AmTy-Kb; Wed, 05 Apr 2023 16:10:15 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Bin Liu , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 05/10] usb: musb: musb_core: Convert to platform remove callback returning void Date: Wed, 5 Apr 2023 16:10:04 +0200 Message-Id: <20230405141009.3400693-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> References: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1686; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=crGRuOuPMXl4l9l1Z2XFjbub8rVkugfAjCe7A1fNn3U=; b=owGbwMvMwMXY3/A7olbonx/jabUkhhTdRrPkstdrQhwW+t1UMbVvO7antHWBL4OrveHOq1/W5 fSUPBPqZDRmYWDkYpAVU2Sxb1yTaVUlF9m59t9lmEGsTCBTGLg4BWAic6XZ/+dy/U1ni8nUSowN a5O9mPrBPHxqysxtEUzaZ+ZUxzQWCV83mjnhw33TwP98vZaf18c+k9sksGnSk+o3b95N4EgTrYy dsrLcgqFqVmx8+9IpK3PPz25iEWA+k+v0ZHJgwHsT75ML7u16/SyNqS21wtIqwHKfiPbqVaFabD OlP5hprCgUniDyPDmrMZxJO+zK3ODVqX7q/TPbv3smvo7XiWu6p6X/OS44UOSck+wEk6KpTToOv SsiHgvNsV8mwbR9iYB175MHflN4uP7d3CY3keV2uVrMxtaKFIHWA1LRSbvOpHI/jtKpv3hcNHHX 46d7mXy67LpPznEz6A0O8VucXrpxX6bs1CeToxwrzrUDAA== 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: linux-usb@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.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/usb/musb/musb_core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 648bb6021c5e..d162afbbe19f 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2621,7 +2621,7 @@ static int musb_probe(struct platform_device *pdev) return musb_init_controller(dev, irq, base); } -static int musb_remove(struct platform_device *pdev) +static void musb_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct musb *musb = dev_to_musb(dev); @@ -2657,7 +2657,6 @@ static int musb_remove(struct platform_device *pdev) usb_phy_shutdown(musb->xceiv); musb_free(musb); device_init_wakeup(dev, 0); - return 0; } #ifdef CONFIG_PM @@ -2955,7 +2954,7 @@ static struct platform_driver musb_driver = { .dev_groups = musb_groups, }, .probe = musb_probe, - .remove = musb_remove, + .remove_new = musb_remove, }; module_platform_driver(musb_driver); From patchwork Wed Apr 5 14:10:05 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: 13201821 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 A158BC76188 for ; Wed, 5 Apr 2023 14:11:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238512AbjDEOLS (ORCPT ); Wed, 5 Apr 2023 10:11:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238515AbjDEOKs (ORCPT ); Wed, 5 Apr 2023 10:10:48 -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 7FB7C3596 for ; Wed, 5 Apr 2023 07:10:20 -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 1pk3q5-0003FU-D1; Wed, 05 Apr 2023 16:10:17 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pk3q4-009Abv-NB; Wed, 05 Apr 2023 16:10:16 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pk3q3-00AmU2-Qz; Wed, 05 Apr 2023 16:10:15 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Bin Liu , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 06/10] usb: musb: musb_dsps: Convert to platform remove callback returning void Date: Wed, 5 Apr 2023 16:10:05 +0200 Message-Id: <20230405141009.3400693-7-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> References: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1740; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=6KE1F2nyUXQt1T0UuWoQejC3yG3gBo+mM2Ptn4QIZGo=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkLYE3+WQgq2KrFae/2daNqMQZwehnNLauRVMz1 hHooInL4OuJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZC2BNwAKCRCPgPtYfRL+ TryGCAC1bhLXlozOFqRjows7ZJb7VIi6Tk7wif26Pcdswo+DI9IrgxThjd7mZM7k/oC/uwXpCpR 52rrYMoXoGJbizpQPMXVl52PUVw/aeW/E4+2a1ShbD4qSbHLNjBiMkQYIO59yU4rQJvbDN7GP4H nQpJ5y44nFCFmqSC5LFJ4kwNDwWJOoVgW1BBuPqnOmQNgjEZXzAKLEWt8Z07dAwCPq8iLIlVOTP tiHpksIrsx/fXtLS69bfbETMZNG5UgmrUwT6DWEDulVNWmgepMEz6pCTt6UoWq05ANNtyZKENdm j5eMh2hTRYq16qXeq3Cw2W/vJZLTw7Yizz5V/BEOAFKAKU1l 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: linux-usb@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.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/usb/musb/musb_dsps.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index f75cde0f2b43..9119b1d51370 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -915,7 +915,7 @@ static int dsps_probe(struct platform_device *pdev) return ret; } -static int dsps_remove(struct platform_device *pdev) +static void dsps_remove(struct platform_device *pdev) { struct dsps_glue *glue = platform_get_drvdata(pdev); @@ -923,8 +923,6 @@ static int dsps_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); iounmap(glue->usbss_base); - - return 0; } static const struct dsps_musb_wrapper am33xx_driver_data = { @@ -1036,7 +1034,7 @@ static SIMPLE_DEV_PM_OPS(dsps_pm_ops, dsps_suspend, dsps_resume); static struct platform_driver dsps_usbss_driver = { .probe = dsps_probe, - .remove = dsps_remove, + .remove_new = dsps_remove, .driver = { .name = "musb-dsps", .pm = &dsps_pm_ops, From patchwork Wed Apr 5 14:10:06 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: 13201822 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 68C9DC761A6 for ; Wed, 5 Apr 2023 14:11:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238213AbjDEOLT (ORCPT ); Wed, 5 Apr 2023 10:11:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238194AbjDEOKt (ORCPT ); Wed, 5 Apr 2023 10:10: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 5BA8C6189 for ; Wed, 5 Apr 2023 07:10:21 -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 1pk3q5-0003GQ-Ut; Wed, 05 Apr 2023 16:10:17 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pk3q5-009Ac6-9u; Wed, 05 Apr 2023 16:10:17 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pk3q3-00AmU6-W3; Wed, 05 Apr 2023 16:10:16 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Bin Liu , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 07/10] usb: musb: omap2430: Convert to platform remove callback returning void Date: Wed, 5 Apr 2023 16:10:06 +0200 Message-Id: <20230405141009.3400693-8-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> References: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1612; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=fpeE+Ge4ARMI4IggZAgUxLsZl9QZ9LDERd7rfVKs2EA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkLYE43yepirPGkz3qKepI9oJn36TMEVA4O/IXA FrmyI5U64qJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZC2BOAAKCRCPgPtYfRL+ TrJXCACvi5mVqw9hDEcRHmCGkLofP4bhjj+qHHKDy2COi/8DWEGh2pFy3Y/E6hle+TZP7bMUBfW YV9rBTisj7ssLrEOy1UELFpTft1aeUMMjb8Od0cBe+cc9kxfqH7jfozhOidwpXmUrW1Yc83j4IX O7gpa+ofBxznsdtupasd/OJS30x3LNak29kZtoQ3mML60Z8VJczn0r7IsG6BVdY8Wc7rBb2c9Wo 19hjy++cCFCyg7W6r9XqfGIX++qGPfLVMdgB2YjmyWnBGGMqrDfLHbLIBd1KgDaUMixSa+bxrsc J3jW0kaNdKfW3QqX/u7ipjmVjCTvAfVQsImELmIHG8Mi0NUU 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: linux-usb@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.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/usb/musb/omap2430.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 44a21ec865fb..b9ab0c48e2ee 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -471,14 +471,12 @@ static int omap2430_probe(struct platform_device *pdev) return ret; } -static int omap2430_remove(struct platform_device *pdev) +static void omap2430_remove(struct platform_device *pdev) { struct omap2430_glue *glue = platform_get_drvdata(pdev); platform_device_unregister(glue->musb); pm_runtime_disable(glue->dev); - - return 0; } #ifdef CONFIG_PM @@ -610,7 +608,7 @@ MODULE_DEVICE_TABLE(of, omap2430_id_table); static struct platform_driver omap2430_driver = { .probe = omap2430_probe, - .remove = omap2430_remove, + .remove_new = omap2430_remove, .driver = { .name = "musb-omap2430", .pm = DEV_PM_OPS, From patchwork Wed Apr 5 14:10:07 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: 13201826 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 580BCC76188 for ; Wed, 5 Apr 2023 14:11:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238446AbjDEOL0 (ORCPT ); Wed, 5 Apr 2023 10:11:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238434AbjDEOK6 (ORCPT ); Wed, 5 Apr 2023 10:10:58 -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 E4DDB6EB1 for ; Wed, 5 Apr 2023 07:10:29 -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 1pk3q6-0003Gd-5b; Wed, 05 Apr 2023 16:10:18 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pk3q5-009AcB-Ge; Wed, 05 Apr 2023 16:10:17 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pk3q4-00AmUB-5w; Wed, 05 Apr 2023 16:10:16 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Bin Liu , Greg Kroah-Hartman , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, kernel@pengutronix.de Subject: [PATCH 08/10] usb: musb: sunxi: Convert to platform remove callback returning void Date: Wed, 5 Apr 2023 16:10:07 +0200 Message-Id: <20230405141009.3400693-9-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> References: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1723; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=VGy668YjNWEOyE9jlokD5shLJgWu2+buOf3F85pJEhw=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkLYE5nUtPCluhFwk7HJgsIfzc/ASCOAvSSwMHx aB5wp0TUjWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZC2BOQAKCRCPgPtYfRL+ TochB/0fSfsfOZmiWE3YGBXkM9CLeY37F+JhJp8fxt38Kl0QbaeEHTMocCk2SRrVUgaV38SWmRW BDO6S3a1CfB/1nuaRThsJLKQx08WJspRNArSQnOHPMAQ8vvFaOXa65EUP9IkfLL6CyMyLbFpPRr O8QUj8901MWJKv5ONV4UPKT408HAd17ojVBvdQJMH41uOrs5358Dc+e0f93s87k16L8MRSR3ep6 w2P8jscxPHFp1s4pe8Nmk48DnGWZiKiiKD3ofkHW03ECfS/97Ow+i4PmOHaIPInnXLe/PprmjDK CYQ76pAWaO89Vo8c+a36t8Y5K55Ub8psu77YBTwFdKsPSZnd 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: linux-usb@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.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 Acked-by: Jernej Skrabec --- drivers/usb/musb/sunxi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/musb/sunxi.c b/drivers/usb/musb/sunxi.c index 9b622cd9b2bd..c5c6c4e09300 100644 --- a/drivers/usb/musb/sunxi.c +++ b/drivers/usb/musb/sunxi.c @@ -805,15 +805,13 @@ static int sunxi_musb_probe(struct platform_device *pdev) return ret; } -static int sunxi_musb_remove(struct platform_device *pdev) +static void sunxi_musb_remove(struct platform_device *pdev) { struct sunxi_glue *glue = platform_get_drvdata(pdev); struct platform_device *usb_phy = glue->usb_phy; platform_device_unregister(glue->musb_pdev); usb_phy_generic_unregister(usb_phy); - - return 0; } static const struct sunxi_musb_cfg sun4i_a10_musb_cfg = { @@ -862,7 +860,7 @@ MODULE_DEVICE_TABLE(of, sunxi_musb_match); static struct platform_driver sunxi_musb_driver = { .probe = sunxi_musb_probe, - .remove = sunxi_musb_remove, + .remove_new = sunxi_musb_remove, .driver = { .name = "musb-sunxi", .of_match_table = sunxi_musb_match, From patchwork Wed Apr 5 14:10:08 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: 13201819 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 C5816C76188 for ; Wed, 5 Apr 2023 14:11:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238534AbjDEOLP (ORCPT ); Wed, 5 Apr 2023 10:11:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238160AbjDEOKr (ORCPT ); Wed, 5 Apr 2023 10:10:47 -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 82F9959D0 for ; Wed, 5 Apr 2023 07:10:20 -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 1pk3q5-0003G8-NJ; Wed, 05 Apr 2023 16:10:17 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pk3q5-009Abz-2C; Wed, 05 Apr 2023 16:10:17 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pk3q4-00AmUF-CU; Wed, 05 Apr 2023 16:10:16 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Bin Liu , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 09/10] usb: musb: tusb6010: Convert to platform remove callback returning void Date: Wed, 5 Apr 2023 16:10:08 +0200 Message-Id: <20230405141009.3400693-10-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> References: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1486; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=P2Rr3wxJ8RtCwrVv8C67f+927sxLjVnIvdqFJiIrgD4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkLYE610yxluT1n7rHPvoOFhGLs/MFXP1T0Psym SUQvNoSZyKJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZC2BOgAKCRCPgPtYfRL+ TnZYB/982d1elPkzqHwjPiU9kIwZKVlJiw+XLG4iW+UUjLfnxWpBfVvhx9bchKHtgs3zzaqzlfV ZAvK+tgXpvAkd43nR63xSOs084uMdu2pWrfbMNEcYaoQzLQLSLZ83MPROYjqwhVpYSac4n1ULpv jX3J8oqNKLahAD2z5RVZGwyIUU4uJvVFjeY/YrFUYZqx1nojdTUU+32H0IwHX+1oOf2tHhcT9e6 XV48HLYKqT0IR6XiYtOVUS67JARXs+GiFnu2w0qA4/j0iH6P/ybxZAzbI7VSpKSLGfucDZ4egdA z0kebBwLY0JjHV/m1YPANT08fX27iRV2lwkADbdkp3+29Mun 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: linux-usb@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.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/usb/musb/tusb6010.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 5609b4e84d40..a1f29dbc62e6 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c @@ -1258,19 +1258,17 @@ static int tusb_probe(struct platform_device *pdev) return 0; } -static int tusb_remove(struct platform_device *pdev) +static void tusb_remove(struct platform_device *pdev) { struct tusb6010_glue *glue = platform_get_drvdata(pdev); platform_device_unregister(glue->musb); usb_phy_generic_unregister(glue->phy); - - return 0; } static struct platform_driver tusb_driver = { .probe = tusb_probe, - .remove = tusb_remove, + .remove_new = tusb_remove, .driver = { .name = "musb-tusb", }, From patchwork Wed Apr 5 14:10:09 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: 13201824 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 4A5D3C7619A for ; Wed, 5 Apr 2023 14:11:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238339AbjDEOLW (ORCPT ); Wed, 5 Apr 2023 10:11:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238286AbjDEOKy (ORCPT ); Wed, 5 Apr 2023 10:10:54 -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 2973E4EDB for ; Wed, 5 Apr 2023 07:10:23 -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 1pk3q6-0003H0-F2; Wed, 05 Apr 2023 16:10:18 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pk3q5-009AcF-Qv; Wed, 05 Apr 2023 16:10:17 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pk3q4-00AmUI-JF; Wed, 05 Apr 2023 16:10:16 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Bin Liu , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 10/10] usb: musb: ux500: Convert to platform remove callback returning void Date: Wed, 5 Apr 2023 16:10:09 +0200 Message-Id: <20230405141009.3400693-11-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> References: <20230405141009.3400693-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1576; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=eLu4VSPwdEZkERiXVgtXQcIuc34wrNncmVN9nUn/meQ=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkLYE81erFsrPrNRsIFG11KRo/L3B2X+Ts17oJf FqIDuTOCQSJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZC2BPAAKCRCPgPtYfRL+ Tn+3B/9JATq6Y6RamcK5orLBtsBTiC+zmeFY5CLye1O/U2sZjaATMtUbws0D9x5JxiC/xjqvVDE tQXgQ/91yWGYYlitz+v/kqXwDme9DTqiHAxg5lXvaOyyaLwe3DhI+t4tm1WvuSGXSd1vNS4tsey TLWA8jJv+/sr4Fik8vql1G2RWz94yxJmyXut5vuuTgMS9VQjpH8+Pqw/n+OT7YwxgS3sGKcLzIv 4A9IHjmBLXxuV0hASO5prd7FCvSnbxSZP0ERgv0GoLdtFcUPNVZVcDOKM1AsVNkXpJ7C7RnPRL/ NDCM3hz6BltBbpH3FRHz0mDY9HrTTqH6vUHVWF26ViD6IvTz 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: linux-usb@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.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/usb/musb/ux500.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index 8ea62c344328..c8d9d2a1d2f0 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c @@ -303,14 +303,12 @@ static int ux500_probe(struct platform_device *pdev) return ret; } -static int ux500_remove(struct platform_device *pdev) +static void ux500_remove(struct platform_device *pdev) { struct ux500_glue *glue = platform_get_drvdata(pdev); platform_device_unregister(glue->musb); clk_disable_unprepare(glue->clk); - - return 0; } #ifdef CONFIG_PM_SLEEP @@ -357,7 +355,7 @@ MODULE_DEVICE_TABLE(of, ux500_match); static struct platform_driver ux500_driver = { .probe = ux500_probe, - .remove = ux500_remove, + .remove_new = ux500_remove, .driver = { .name = "musb-ux500", .pm = &ux500_pm_ops,