From patchwork Tue Dec 19 17:31:59 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: 13498636 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 715E237D0C for ; Tue, 19 Dec 2023 17:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rFdxC-0005vG-8u; Tue, 19 Dec 2023 18:32:26 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rFdxA-0004Go-GL; Tue, 19 Dec 2023 18:32:25 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rFdxB-000CpP-AE; Tue, 19 Dec 2023 18:32:25 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Moritz Fischer , Wu Hao , Xu Yilun Cc: Tom Rix , linux-fpga@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 01/13] fpga: altera-fpga2sdram: Convert to platform remove callback returning void Date: Tue, 19 Dec 2023 18:31:59 +0100 Message-ID: <017b9e17a0c88b2a633467633d304639e7765926.1703006638.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1756; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=/O0zBG+j6BZWO8a8WR2bbHOJAzd+6kfq+RkQkZ+8ZWc=; b=owGbwMvMwMXY3/A7olbonx/jabUkhtTGy/1JflZCa684bV4i8aX33rZfd7bcNvsY+0fjzM5uH baHaUxPOxmNWRgYuRhkxRRZ7BvXZFpVyUV2rv13GWYQKxPIFAYuTgGYiEU4B8OE3Udj37TFzOmr F9AQ1N3BX8rKxccdWsitX6xz7UXWVE/TtFN//3qeWcYtf4ctUze03FFiT0PxvL2KFWkrV6Yuf3h XzyDXqdk17eB1nd1+lowmRU2/fya4nFSLZq9I2b6r3FP057VPf1IrNiXPrTm9Zd/DsNylNZy3OU Q7XYILg+on/XLunq8tI+eX8aeei9NW2KTE5stpz/MfTjF3PuEJ45jZ8EMl1d4wJj/D45R34jL1r 9GbSr7Lau1t2WelPtU1jTHhK98/ewmxfP2/lbocH6d01bwV9f3fpdHJsETuvmqHUMjv1ImHbm+u 6QzhuvHn84sHAtnl33Ui77zdeu6h3PXpmjVfpJm1d0cBAA== 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: linux-fpga@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 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/fpga/altera-fpga2sdram.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/altera-fpga2sdram.c b/drivers/fpga/altera-fpga2sdram.c index 1fa2ccc321ab..6b60ca004345 100644 --- a/drivers/fpga/altera-fpga2sdram.c +++ b/drivers/fpga/altera-fpga2sdram.c @@ -147,20 +147,18 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev) return ret; } -static int alt_fpga_bridge_remove(struct platform_device *pdev) +static void alt_fpga_bridge_remove(struct platform_device *pdev) { struct fpga_bridge *br = platform_get_drvdata(pdev); fpga_bridge_unregister(br); - - return 0; } MODULE_DEVICE_TABLE(of, altera_fpga_of_match); static struct platform_driver altera_fpga_driver = { .probe = alt_fpga_bridge_probe, - .remove = alt_fpga_bridge_remove, + .remove_new = alt_fpga_bridge_remove, .driver = { .name = "altera_fpga2sdram_bridge", .of_match_table = of_match_ptr(altera_fpga_of_match), From patchwork Tue Dec 19 17:32: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: 13498638 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A80337D02 for ; Tue, 19 Dec 2023 17:32:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rFdxC-0005vH-8w; Tue, 19 Dec 2023 18:32:26 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rFdxA-0004Gr-MR; Tue, 19 Dec 2023 18:32:25 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rFdxB-000CpT-GI; Tue, 19 Dec 2023 18:32:25 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Moritz Fischer , Wu Hao , Xu Yilun Cc: Tom Rix , linux-fpga@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 02/13] fpga: altera-freeze-bridge: Convert to platform remove callback returning void Date: Tue, 19 Dec 2023 18:32:00 +0100 Message-ID: <7f4fcb23b25400c6711848105823081e032c5266.1703006638.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1711; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=xiSiCsZnqLmGC3n7yIqy4nLCQmQIom9WtygnyouKV5c=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlgdOQpusgm15GGAXfytldR9Eh16j1/NeUwEuSp 8djRXxRLP6JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZYHTkAAKCRCPgPtYfRL+ Tq5FB/4s2a49afCLXeZIHj9nCU0QPLGkM3ajyQHb26L3WPz8whY8A86sWLBYRMQ/5oeI6RfY5xZ xBz999sCyAXivYW1metycn2qpUMjsbHQGEWZ7G2c8SwtBqINyR26MNc1kkHAZP10GLZoW6vmPQt Uwq0eNve/UsJaflvJCcDK5N05E3GGvvtn+U6HwLUaAagWdm1Abpi/6HvRwelttBJfRhkNCVav8a AFWWGK4ROuobTg0CbmLRmaCOuVG1aKfvLC6J+7xmpM52G0dRz9h3gudqA3jQC+fRMz98+VYiJkr oVpDH84+017r+2bGVePxzEjUkeyzykAQdw+ew0IDyO0KWQ36 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: linux-fpga@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 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/fpga/altera-freeze-bridge.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/altera-freeze-bridge.c b/drivers/fpga/altera-freeze-bridge.c index 0c3fb8226908..44061cb16f87 100644 --- a/drivers/fpga/altera-freeze-bridge.c +++ b/drivers/fpga/altera-freeze-bridge.c @@ -253,18 +253,16 @@ static int altera_freeze_br_probe(struct platform_device *pdev) return 0; } -static int altera_freeze_br_remove(struct platform_device *pdev) +static void altera_freeze_br_remove(struct platform_device *pdev) { struct fpga_bridge *br = platform_get_drvdata(pdev); fpga_bridge_unregister(br); - - return 0; } static struct platform_driver altera_freeze_br_driver = { .probe = altera_freeze_br_probe, - .remove = altera_freeze_br_remove, + .remove_new = altera_freeze_br_remove, .driver = { .name = "altera_freeze_br", .of_match_table = altera_freeze_br_of_match, From patchwork Tue Dec 19 17:32: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: 13498631 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46AB137D07 for ; Tue, 19 Dec 2023 17:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rFdxC-0005vI-BP; Tue, 19 Dec 2023 18:32:26 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rFdxA-0004Gu-SC; Tue, 19 Dec 2023 18:32:25 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rFdxB-000CpW-MC; Tue, 19 Dec 2023 18:32:25 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Moritz Fischer , Wu Hao , Xu Yilun Cc: Tom Rix , linux-fpga@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 03/13] fpga: altera-hps2fpga: Convert to platform remove callback returning void Date: Tue, 19 Dec 2023 18:32:01 +0100 Message-ID: <7a56558f7e5aa34bf0b21d22f9036a136a2b7322.1703006638.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1931; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=F2MnFt/yPjA7nzwA5h/JxIGxY00gbHc4ttRT3fEMqB4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlgdORhP5XSv5tyDR6nqmBhttWiUMKiUvkwCekb gy+K/gKdoOJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZYHTkQAKCRCPgPtYfRL+ ToRzCACLc51rOAnOYTUNWMRstZkdbRSgB3HGV8EO2SLexsIeL/YbyDUfGcGRT+xgi+oPL/+n/0+ HqTF18b8sDmkfkLsnpZHTlI5oYXNgKXU8wblQ6TFrKelgpLg+zoMb0PRn3DFUmt+jfQeT7M36Ei DsntnhZxFdHI2poVCUFslUTd2Cg22x5eAJAKAHCBkmMxIXtl+BGlBAp4D+2n5YsNy3PWtWWnXEQ C8iTqWBNTktOZdtvK9jGjPExe92Svyl7lSol9WGsyvgg29O6OYUO0MGTqdh1X4pkbPB/uSaHmNE vrLfO6aOITSbrx4r/XZjFaWxyH9EI3rVINEhkTRvyYoYRHAp 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: linux-fpga@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 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/fpga/altera-hps2fpga.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/altera-hps2fpga.c b/drivers/fpga/altera-hps2fpga.c index 578663503297..6f8e24be19c6 100644 --- a/drivers/fpga/altera-hps2fpga.c +++ b/drivers/fpga/altera-hps2fpga.c @@ -191,7 +191,7 @@ static int alt_fpga_bridge_probe(struct platform_device *pdev) return ret; } -static int alt_fpga_bridge_remove(struct platform_device *pdev) +static void alt_fpga_bridge_remove(struct platform_device *pdev) { struct fpga_bridge *bridge = platform_get_drvdata(pdev); struct altera_hps2fpga_data *priv = bridge->priv; @@ -199,15 +199,13 @@ static int alt_fpga_bridge_remove(struct platform_device *pdev) fpga_bridge_unregister(bridge); clk_disable_unprepare(priv->clk); - - return 0; } MODULE_DEVICE_TABLE(of, altera_fpga_of_match); static struct platform_driver alt_fpga_bridge_driver = { .probe = alt_fpga_bridge_probe, - .remove = alt_fpga_bridge_remove, + .remove_new = alt_fpga_bridge_remove, .driver = { .name = "altera_hps2fpga_bridge", .of_match_table = of_match_ptr(altera_fpga_of_match), From patchwork Tue Dec 19 17:32: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: 13498634 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BFF737D08 for ; Tue, 19 Dec 2023 17:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rFdxC-0005vb-IJ; Tue, 19 Dec 2023 18:32:26 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rFdxB-0004Gx-2S; Tue, 19 Dec 2023 18:32:26 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rFdxB-000Cpb-Sp; Tue, 19 Dec 2023 18:32:25 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Wu Hao , Moritz Fischer , Xu Yilun Cc: Tom Rix , linux-fpga@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 04/13] fpga: dfl-afu-main: Convert to platform remove callback returning void Date: Tue, 19 Dec 2023 18:32:02 +0100 Message-ID: <351a4508a2feeba05b2c311fa8596ca1ad77f467.1703006638.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1707; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=kVuAt2Ig4hTe4gzLvGu3mX7rofPGIzf33UNjn1cPlLI=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlgdOSeeBIy4USyQFeqKYsi2JvkjU7UTzOoFmHp C5prLS+S1mJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZYHTkgAKCRCPgPtYfRL+ TsePCACnH86L9jrchEguUw3jCMPRGy8Ys5qpKBCdiO9YGTUdcd5HtMh0G/Oee1L0plGOuvJLmI0 dkq40l58+FSjVcPTFmsJgRq7SoITCorToGE0YmMqDZ6PY3Kf8mO51YMl9XN/eakBqa3pUYB9yvr rIXQes/hALEBLoTbLs7407qTn1nNVnyX8JbiMDg7iX0GqRxEif16RkXHVwPYRRYTm54dYs6D3r6 DA9hQe9jG+ISfKTffr4ekDdb0JyHjhCK197xzRyxbeTQgZ+/iggtXIe9G4vaGr2o6gPWpVOY0/b LAmcn5Gq81qb3ulHWkJ6VW0XGGl45vMTdKT8qSNVhgSt5AzY 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: linux-fpga@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 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/fpga/dfl-afu-main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c index 7f621e96d3b8..c0a75ca360d6 100644 --- a/drivers/fpga/dfl-afu-main.c +++ b/drivers/fpga/dfl-afu-main.c @@ -932,15 +932,13 @@ static int afu_probe(struct platform_device *pdev) return ret; } -static int afu_remove(struct platform_device *pdev) +static void afu_remove(struct platform_device *pdev) { dev_dbg(&pdev->dev, "%s\n", __func__); dfl_fpga_dev_ops_unregister(pdev); dfl_fpga_dev_feature_uinit(pdev); afu_dev_destroy(pdev); - - return 0; } static const struct attribute_group *afu_dev_groups[] = { @@ -956,7 +954,7 @@ static struct platform_driver afu_driver = { .dev_groups = afu_dev_groups, }, .probe = afu_probe, - .remove = afu_remove, + .remove_new = afu_remove, }; static int __init afu_init(void) From patchwork Tue Dec 19 17:32: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: 13498633 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 715A737D0B for ; Tue, 19 Dec 2023 17:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rFdxC-0005vx-OT; Tue, 19 Dec 2023 18:32:26 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rFdxB-0004H0-8o; Tue, 19 Dec 2023 18:32:26 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rFdxC-000Cpf-2l; Tue, 19 Dec 2023 18:32:26 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Wu Hao , Moritz Fischer , Xu Yilun Cc: Tom Rix , linux-fpga@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 05/13] fpga: dfl-fme-br: Convert to platform remove callback returning void Date: Tue, 19 Dec 2023 18:32:03 +0100 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-fpga@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:message-id; bh=cpWEzlfs93oy0uzY4PczLW2WO9WfC9XcaQn9PxlqE0k=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlgdOT0ig7j0lfqiDXBD+ZQ8Dij8T+qElwdDVSA 8AQ9jVF9/KJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZYHTkwAKCRCPgPtYfRL+ TgrQB/901CVLrhIEKY/9UbvUaBicTdLopblwuegMqVaEY5SQpHuP5IaKrJAMWYlylSKdFZtNCRO Xk30MxUXAf6O+D+aABKBuGQT0bYh9ciSyFzpR1T/cXIhqU+fy2Xc71InByTiFSmAUTsKjijd8WD 7q5nDPWrHGQ7C0yacD+/QlyNWFztVdYpi9Kop3vq3imcBu6kaNPqGE8PqM04Xce72X2WfU+PKVG PYq0kZhQxnzE0qryU5V+ExXDrQmN7aZ2gFlF3tY5/TONt6XjYiR5Eu4mx2ndqfAd/b60Ows6M+V zuOCh8G47Cnful82FBV/BbXvWOUYp/ZfGA6P+LszFMRaasMK 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: linux-fpga@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 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/fpga/dfl-fme-br.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/dfl-fme-br.c b/drivers/fpga/dfl-fme-br.c index 808d1f4d76df..0b01b3895277 100644 --- a/drivers/fpga/dfl-fme-br.c +++ b/drivers/fpga/dfl-fme-br.c @@ -78,7 +78,7 @@ static int fme_br_probe(struct platform_device *pdev) return 0; } -static int fme_br_remove(struct platform_device *pdev) +static void fme_br_remove(struct platform_device *pdev) { struct fpga_bridge *br = platform_get_drvdata(pdev); struct fme_br_priv *priv = br->priv; @@ -89,8 +89,6 @@ static int fme_br_remove(struct platform_device *pdev) put_device(&priv->port_pdev->dev); if (priv->port_ops) dfl_fpga_port_ops_put(priv->port_ops); - - return 0; } static struct platform_driver fme_br_driver = { @@ -98,7 +96,7 @@ static struct platform_driver fme_br_driver = { .name = DFL_FPGA_FME_BRIDGE, }, .probe = fme_br_probe, - .remove = fme_br_remove, + .remove_new = fme_br_remove, }; module_platform_driver(fme_br_driver); From patchwork Tue Dec 19 17:32: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: 13498640 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80FB937D0F for ; Tue, 19 Dec 2023 17:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rFdxC-0005wA-Vj; Tue, 19 Dec 2023 18:32:26 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rFdxB-0004H7-G8; Tue, 19 Dec 2023 18:32:26 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rFdxC-000Cpj-A3; Tue, 19 Dec 2023 18:32:26 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Wu Hao , Moritz Fischer , Xu Yilun Cc: Tom Rix , linux-fpga@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 06/13] fpga: dfl-fme-main: Convert to platform remove callback returning void Date: Tue, 19 Dec 2023 18:32:04 +0100 Message-ID: <438bb4797984fbfd0cef501010a64fa1e42ad9f4.1703006638.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1665; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=qfB5i+dUHckThGJDxVawBxUYk6jLLVFxmgRke5aDk5g=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlgdOU73secTwGqydXpibi+xQrgc/9aeuncTw7m e1cc6XjucqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZYHTlAAKCRCPgPtYfRL+ Tv5ACACYffed80Ns9oh/1aOfFBm6L+Xngs3B9JWXma3660ouHgK3qKXhYWoIiAkdUNP3TvH9ImO imZJ4xya2+xh1er6VWlhdD8ELyse5LosyJFYIIwHd4EAGIfUmdyQM+OWKs9hMKvNOS2VMnugfSC jlT4R1Ue/V5HEykfp3pR4lANSmuVqzsKZRXzmaWSGXgbCX8NUafCQbXe+5bIz0dzPqY6IWxtv54 3LcN3jyyqWwqMJ8D4KRMbOtUk9t7r5jgPWj3NKipUlD8WOZjTPBo98weHBqMlxUqYvhEHC/Edpl SQkFHX2/3dXjLhbBpBE98Cq4ZqiH6exRtnHFssMigsHUx884 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: linux-fpga@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 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/fpga/dfl-fme-main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/dfl-fme-main.c b/drivers/fpga/dfl-fme-main.c index 3dcf990bd261..a2b5da0093da 100644 --- a/drivers/fpga/dfl-fme-main.c +++ b/drivers/fpga/dfl-fme-main.c @@ -730,13 +730,11 @@ static int fme_probe(struct platform_device *pdev) return ret; } -static int fme_remove(struct platform_device *pdev) +static void fme_remove(struct platform_device *pdev) { dfl_fpga_dev_ops_unregister(pdev); dfl_fpga_dev_feature_uinit(pdev); fme_dev_destroy(pdev); - - return 0; } static const struct attribute_group *fme_dev_groups[] = { @@ -751,7 +749,7 @@ static struct platform_driver fme_driver = { .dev_groups = fme_dev_groups, }, .probe = fme_probe, - .remove = fme_remove, + .remove_new = fme_remove, }; module_platform_driver(fme_driver); From patchwork Tue Dec 19 17:32: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: 13498635 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7158837D0A for ; Tue, 19 Dec 2023 17:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rFdxD-0005wF-62; Tue, 19 Dec 2023 18:32:27 +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 1rFdxB-0004HD-ML; Tue, 19 Dec 2023 18:32:26 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rFdxC-000Cpn-G2; Tue, 19 Dec 2023 18:32:26 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Wu Hao , Moritz Fischer , Xu Yilun Cc: Tom Rix , linux-fpga@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 07/13] fpga: dfl-fme-region: Convert to platform remove callback returning void Date: Tue, 19 Dec 2023 18:32:05 +0100 Message-ID: <13187db1642f81f04e55be0a26045f09ccc95d37.1703006638.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1785; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=dBaTbnikILumgVfq0dE0u3xfKKC6APd7/tEpjPEswMA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlgdOV+b4GsCu/7+cejuJ84AstdN1zJc+UtPhJt BIDT7LgExqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZYHTlQAKCRCPgPtYfRL+ Tl+mB/9ae2NShiLTGcM6GiGfGq+8ets1CV9LC+taPkRkg15YAQ16wcq9JyQCvF2bEEyBDdA3PoJ 8C9c68VgqREZFu7iwHK7sqi6IoPBsbFzHwCGP5Iij2UZvkUjIbbqXeRevPTPcyEiw5Ymx0SsAoU HYzdkm/oJmlLdTWnzXATHZBgXmyH5gl5oSOT2uV1KY3FxtznD1wYGFgtwmzA5wuYT58pi0tqXxg ZpdZX5EdqqXAyNuFG2Wn7hg1C946koow35vSMW7NfjPYQx2T+94AEo1Llk3pRD9dB9CEzPEB5q9 ZvAUpRMA5Z+f69SSZi8qvajKKqq3K0MT07q6RBl+hxPmrYVv 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: linux-fpga@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 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/fpga/dfl-fme-region.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/dfl-fme-region.c b/drivers/fpga/dfl-fme-region.c index 4aebde0a7f1c..71616f8b4982 100644 --- a/drivers/fpga/dfl-fme-region.c +++ b/drivers/fpga/dfl-fme-region.c @@ -61,15 +61,13 @@ static int fme_region_probe(struct platform_device *pdev) return ret; } -static int fme_region_remove(struct platform_device *pdev) +static void fme_region_remove(struct platform_device *pdev) { struct fpga_region *region = platform_get_drvdata(pdev); struct fpga_manager *mgr = region->mgr; fpga_region_unregister(region); fpga_mgr_put(mgr); - - return 0; } static struct platform_driver fme_region_driver = { @@ -77,7 +75,7 @@ static struct platform_driver fme_region_driver = { .name = DFL_FPGA_FME_REGION, }, .probe = fme_region_probe, - .remove = fme_region_remove, + .remove_new = fme_region_remove, }; module_platform_driver(fme_region_driver); From patchwork Tue Dec 19 17:32: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: 13498641 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B8F424A03 for ; Tue, 19 Dec 2023 17:32:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rFdxD-0005wL-Be; Tue, 19 Dec 2023 18:32:27 +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 1rFdxB-0004HH-S3; Tue, 19 Dec 2023 18:32:26 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rFdxC-000Cpq-M5; Tue, 19 Dec 2023 18:32:26 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Moritz Fischer , Wu Hao , Xu Yilun Cc: Peter Colberg , Tom Rix , linux-fpga@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 08/13] fpga: intel-m10-bmc-sec-update: Convert to platform remove callback returning void Date: Tue, 19 Dec 2023 18:32:06 +0100 Message-ID: <8d7b192ade744a70da4d7bc681ee4e00f9d04ba9.1703006638.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1922; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=x/91DhywnpZtlOuTo5ij49/8knaEiA9uKV9pkUBzyDw=; b=owGbwMvMwMXY3/A7olbonx/jabUkhtTGy9P5Utm2bjr5846Rp6cYy5LYCwnKX4LExBZ3vdo1T /nU3b88nYzGLAyMXAyyYoos9o1rMq2q5CI71/67DDOIlQlkCgMXpwBM5NRU9n9qkq/VY1Xc3GzX 69duTohTOSH8Y0OetpFlSbiau93cP3KmB877G4XMNd79NsmTI/BW2f50+22CMi0dfvl2vDbPqkr +N99malCpnplpw7bTub7T5WDAL9e53PsZpJbpzzPTnBy+9qQhQ5Os1dn3y+aYHd6y6bOxdt72lX EZdUyuS5asF7rBXlB6xz+e77Vx/FX3Y19vnrzygKfK7bOTiU4Y3w/+yCWf/tYUz3lX/OOF/NKaR RuCwnxCtNbdsJLqZdBUuHHl6vJsZ4/Cb7H3v7y7pzrJ4PHETy4BTl78ETsrPHL/h4rMXN+adjZV bY+PrXaymUJ0TVZQ5PKwQ3bcH57dabOLazzfvcPV5JQPAA== 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: linux-fpga@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 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/fpga/intel-m10-bmc-sec-update.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/intel-m10-bmc-sec-update.c b/drivers/fpga/intel-m10-bmc-sec-update.c index 31af2e08c825..89851b133709 100644 --- a/drivers/fpga/intel-m10-bmc-sec-update.c +++ b/drivers/fpga/intel-m10-bmc-sec-update.c @@ -730,15 +730,13 @@ static int m10bmc_sec_probe(struct platform_device *pdev) return ret; } -static int m10bmc_sec_remove(struct platform_device *pdev) +static void m10bmc_sec_remove(struct platform_device *pdev) { struct m10bmc_sec *sec = dev_get_drvdata(&pdev->dev); firmware_upload_unregister(sec->fwl); kfree(sec->fw_name); xa_erase(&fw_upload_xa, sec->fw_name_id); - - return 0; } static const struct platform_device_id intel_m10bmc_sec_ids[] = { @@ -760,7 +758,7 @@ MODULE_DEVICE_TABLE(platform, intel_m10bmc_sec_ids); static struct platform_driver intel_m10bmc_sec_driver = { .probe = m10bmc_sec_probe, - .remove = m10bmc_sec_remove, + .remove_new = m10bmc_sec_remove, .driver = { .name = "intel-m10bmc-sec-update", .dev_groups = m10bmc_sec_attr_groups, From patchwork Tue Dec 19 17:32: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: 13498642 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B322737D11 for ; Tue, 19 Dec 2023 17:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rFdxD-0005we-If; Tue, 19 Dec 2023 18:32:27 +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 1rFdxC-0004HL-2j; Tue, 19 Dec 2023 18:32:27 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rFdxC-000Cpv-Sx; Tue, 19 Dec 2023 18:32:26 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Moritz Fischer , Wu Hao , Xu Yilun Cc: Tom Rix , linux-fpga@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 09/13] fpga: of-fpga-region: Convert to platform remove callback returning void Date: Tue, 19 Dec 2023 18:32:07 +0100 Message-ID: <1ff30f297310bf048af567924c0fd4cb7c6c3240.1703006638.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1749; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=bxdYhlr2wtrc/r6OuCAgVp0v9jvTWtFTPxIK2FVz2L4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlgdOYdkgHYhY8SujRMyqkc1ZUgcvGrVQLOyRDC +jbouHdxYmJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZYHTmAAKCRCPgPtYfRL+ TvA1B/0faUTzllU14d/t0gfo862QZSUbOuneerK4WHRyR8ts6ssO3gGvdbEJefvX/+SiPPAOiIT 4xxYbfEbjUXCSs8LOrmW678jDQmWxH4MI94Dmjm5PzHBZA7MuSYJoIIhBgI5puY2WjAmlG4uAcT N8gH1hT+MmX8r0cVoSUrsTe2np6/wbwCCH9ZVVNHvE3j34nMPd9SQUGa5rrdoiv+TC4hoxXBYJb HW9kQKgr2E+CDdgAqveuOrdfpmrgcyE8AI7TaUh4SGodb7AycNUh+nZQrDJkNI5kMR7kmZ1nyTV 5heSZF3tFWPwowTtTbKD4ujCc8z6uh8CszcgaANY/P7VbDhr 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: linux-fpga@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 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/fpga/of-fpga-region.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c index a6affd83f275..8526a5a86f0c 100644 --- a/drivers/fpga/of-fpga-region.c +++ b/drivers/fpga/of-fpga-region.c @@ -425,20 +425,18 @@ static int of_fpga_region_probe(struct platform_device *pdev) return ret; } -static int of_fpga_region_remove(struct platform_device *pdev) +static void of_fpga_region_remove(struct platform_device *pdev) { struct fpga_region *region = platform_get_drvdata(pdev); struct fpga_manager *mgr = region->mgr; fpga_region_unregister(region); fpga_mgr_put(mgr); - - return 0; } static struct platform_driver of_fpga_region_driver = { .probe = of_fpga_region_probe, - .remove = of_fpga_region_remove, + .remove_new = of_fpga_region_remove, .driver = { .name = "of-fpga-region", .of_match_table = of_match_ptr(fpga_region_of_match), From patchwork Tue Dec 19 17:32: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: 13498637 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80FFB37D10 for ; Tue, 19 Dec 2023 17:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rFdxD-0005wo-QO; Tue, 19 Dec 2023 18:32:27 +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 1rFdxC-0004HP-B4; Tue, 19 Dec 2023 18:32:27 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rFdxD-000Cq9-4l; Tue, 19 Dec 2023 18:32:27 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Moritz Fischer , Wu Hao , Xu Yilun Cc: Tom Rix , linux-fpga@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 10/13] fpga: socfpga-a10: Convert to platform remove callback returning void Date: Tue, 19 Dec 2023 18:32:08 +0100 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1897; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=7DXUNhS7l7nG7QSr/74ukFmOeJyAE8NRE33EEE7rEH8=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlgdOZbmlx+ui4sisofnVENxINYWrIaKrv1Z3Qp Deszo42wIyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZYHTmQAKCRCPgPtYfRL+ TqKqB/9g0YDdgNpfCNp7KAVfOV5LW3ePjfoN4mUL701VW5aV5scgswrpHwKxYz0Bf5NPX+5I/4r gTQhTcrm+Wni6BV0V6LRn5/Eb7H3xDrBOMjiu3vmX/EcW/j03xXT0ko2sq7btn6s6ETs559DNEg ITuAXiVtZzNtXM51kzaB+tHDqicYlsQZqg9BuiKk/7bSKKcfdgfsspjMifo2fzpBXbswdQkFF2l 2nqvD5N3OewUfDwM8vTCdR4iCVQ0F5GK/ZoJ6Bcx8TW/hQr2FLVhMJX4I2+XJcd0K21DB/Jl5CZ dL6dqV7bfswinl5h/Cq1e4jE5vNikZkxXIg9T4IOlHbcElT3 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: linux-fpga@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 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/fpga/socfpga-a10.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/socfpga-a10.c b/drivers/fpga/socfpga-a10.c index cc4861e345c9..4c03513b8f03 100644 --- a/drivers/fpga/socfpga-a10.c +++ b/drivers/fpga/socfpga-a10.c @@ -517,15 +517,13 @@ static int socfpga_a10_fpga_probe(struct platform_device *pdev) return 0; } -static int socfpga_a10_fpga_remove(struct platform_device *pdev) +static void socfpga_a10_fpga_remove(struct platform_device *pdev) { struct fpga_manager *mgr = platform_get_drvdata(pdev); struct a10_fpga_priv *priv = mgr->priv; fpga_mgr_unregister(mgr); clk_disable_unprepare(priv->clk); - - return 0; } static const struct of_device_id socfpga_a10_fpga_of_match[] = { @@ -537,7 +535,7 @@ MODULE_DEVICE_TABLE(of, socfpga_a10_fpga_of_match); static struct platform_driver socfpga_a10_fpga_driver = { .probe = socfpga_a10_fpga_probe, - .remove = socfpga_a10_fpga_remove, + .remove_new = socfpga_a10_fpga_remove, .driver = { .name = "socfpga_a10_fpga_manager", .of_match_table = socfpga_a10_fpga_of_match, From patchwork Tue Dec 19 17:32: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: 13498630 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA7B037D02 for ; Tue, 19 Dec 2023 17:32:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rFdxE-0005wy-7j; Tue, 19 Dec 2023 18:32:28 +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 1rFdxC-0004HU-JY; Tue, 19 Dec 2023 18:32:27 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rFdxD-000CqD-DS; Tue, 19 Dec 2023 18:32:27 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Moritz Fischer , Wu Hao , Xu Yilun Cc: Tom Rix , linux-fpga@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 11/13] fpga: stratix10-soc: Convert to platform remove callback returning void Date: Tue, 19 Dec 2023 18:32:09 +0100 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1796; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=6RuvGPNITAvdADFAZXGPf/g8M8lBML2CI2o234ndobo=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlgdOaX6OcbM/RlIBw2Gt56rtZpfXHNSY8RBWOO 6YJ6qO3e4GJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZYHTmgAKCRCPgPtYfRL+ TjYMB/4p9zyfXUf3yXq4/FiqUueW2qy3OW44Bkc1iR3DY26R7TTmwuGKc1fu7x8rMaNdTyl678C 1linYKyT9hxcTkQUlGUML94PSCWM1I7U2+F4wR04r7Bv+L3sw5v2mvaQ/51Ggxg21CsvULBlU0+ wD3a1xWfBb65FIlvzPWyzL/OtMkgyGpIqudCTDT2YolJHnLSNNfShLBnW2rLERGHxzrwzMpQf5A pZeTwRBDQ7y+Cx7LQk46rFld3E91pPfxLy+Fe0YL385l2oyj27I8aPt4Pc8XME7Pow3XOTvrHfL 6jGyofmd7zuAWa+Pg/dvBkLbD8A3TFK3lkUhsbFbrsgh2+X9 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: linux-fpga@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 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/fpga/stratix10-soc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c index cacb9cc5757e..2c0def7d7cbb 100644 --- a/drivers/fpga/stratix10-soc.c +++ b/drivers/fpga/stratix10-soc.c @@ -436,15 +436,13 @@ static int s10_probe(struct platform_device *pdev) return ret; } -static int s10_remove(struct platform_device *pdev) +static void s10_remove(struct platform_device *pdev) { struct fpga_manager *mgr = platform_get_drvdata(pdev); struct s10_priv *priv = mgr->priv; fpga_mgr_unregister(mgr); stratix10_svc_free_channel(priv->chan); - - return 0; } static const struct of_device_id s10_of_match[] = { @@ -457,7 +455,7 @@ MODULE_DEVICE_TABLE(of, s10_of_match); static struct platform_driver s10_driver = { .probe = s10_probe, - .remove = s10_remove, + .remove_new = s10_remove, .driver = { .name = "Stratix10 SoC FPGA manager", .of_match_table = of_match_ptr(s10_of_match), From patchwork Tue Dec 19 17:32:10 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: 13498639 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3314E37D05 for ; Tue, 19 Dec 2023 17:32:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rFdxE-0005xu-Aw; Tue, 19 Dec 2023 18:32:28 +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 1rFdxC-0004HX-Pd; Tue, 19 Dec 2023 18:32:27 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rFdxD-000CqH-Ja; Tue, 19 Dec 2023 18:32:27 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Moritz Fischer , Wu Hao , Xu Yilun Cc: Tom Rix , Michal Simek , linux-fpga@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 12/13] fpga: xilinx-pr-decoupler: Convert to platform remove callback returning void Date: Tue, 19 Dec 2023 18:32:10 +0100 Message-ID: <3e37e7cf91749fbaba67619f4ffc6a9a7352a671.1703006638.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1890; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=HD/6zlCO1lu9B8VXZ6oLk+iu2jmeyH12ZxljOeV/mOQ=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlgdObRFk0XJZoxhnxMYEaKcT2BUO5aJx4F3v3/ HCtKxE2HH6JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZYHTmwAKCRCPgPtYfRL+ TmuVB/4nQ8wls1Qyc6lIvYs0y9ZeqUmYJH3XwctJgrk+wrvGJvRJaYfy+7I59qdmGRhM51A2q62 5ZyaqwT4wdnZp6Zec2vsTV2YeFbpljOKnoHCL2srFJ59c7kUQ3BNw7MFNk8U5z/UynosaRkqsCL J0nu8FtJLJaf9SukVSpIe7oWFSNehpaEbHn7+Uk086tP+1LlTfK1AM2IuVfAkyOgLCDJD4YH4R8 MYQbXmadCpB36N6j/Wfoox73fnhbedF6+LV9CgTza1LeZ91o+17o8sjPhWeLuB5Dwxryuow4YIW 0RfuryLjIpZEl/zNqDGacGEUHP+98uJ/MQk7JSvqL+MqdkmA 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: linux-fpga@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 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/fpga/xilinx-pr-decoupler.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/xilinx-pr-decoupler.c b/drivers/fpga/xilinx-pr-decoupler.c index 68835896f180..788dd2f63a65 100644 --- a/drivers/fpga/xilinx-pr-decoupler.c +++ b/drivers/fpga/xilinx-pr-decoupler.c @@ -150,7 +150,7 @@ static int xlnx_pr_decoupler_probe(struct platform_device *pdev) return err; } -static int xlnx_pr_decoupler_remove(struct platform_device *pdev) +static void xlnx_pr_decoupler_remove(struct platform_device *pdev) { struct fpga_bridge *bridge = platform_get_drvdata(pdev); struct xlnx_pr_decoupler_data *p = bridge->priv; @@ -158,13 +158,11 @@ static int xlnx_pr_decoupler_remove(struct platform_device *pdev) fpga_bridge_unregister(bridge); clk_unprepare(p->clk); - - return 0; } static struct platform_driver xlnx_pr_decoupler_driver = { .probe = xlnx_pr_decoupler_probe, - .remove = xlnx_pr_decoupler_remove, + .remove_new = xlnx_pr_decoupler_remove, .driver = { .name = "xlnx_pr_decoupler", .of_match_table = xlnx_pr_decoupler_of_match, From patchwork Tue Dec 19 17:32:11 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: 13498632 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46A7937D06 for ; Tue, 19 Dec 2023 17:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rFdxE-00060d-NN; Tue, 19 Dec 2023 18:32:28 +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 1rFdxC-0004Hb-W4; Tue, 19 Dec 2023 18:32:28 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rFdxD-000CqL-Q6; Tue, 19 Dec 2023 18:32:27 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Moritz Fischer , Wu Hao , Xu Yilun Cc: Tom Rix , Michal Simek , linux-fpga@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de Subject: [PATCH 13/13] fpga: zynq-fpga: Convert to platform remove callback returning void Date: Tue, 19 Dec 2023 18:32:11 +0100 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-fpga@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1812; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=jbb9mztOMFAL7i/YnhzwmnK1JR3jM4tt5Y5ryqZlUMs=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlgdOca2nKiq7aD//nxu+ibdIF7crRGGAwhaZXE KKSkQWqnj6JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZYHTnAAKCRCPgPtYfRL+ TuQfB/9EZQbb++vmTVnmRaKWKUKE8XPC+Ie6ABunFtcF66SOXmE7NW3kuVDEfE50ciF2i/JX4S1 dWUs8DLIj82ZCUH6KukHxK9I98OzOP7OsUEUKdzr8MlPZ3pgkALDx5zby3WZieIwwNxWPyP3buF vyrpeNPCdFYjA8jitFBeD4ouHy2svtBKax2w3GNUl+1pV3WrV41gZ9xdxaqwvRkqaADfxyHUqrf B8nJxITxIrB4Rt8KvujR8L2xkfAAP42Ckf+W3jyO33L3fMO41zexCkr9bmMaI1xtqbw4gsTILQ5 Cws348vPPDs09Tupg4guVxd+/Ez01c1YNnQ9ic5LOr2BplI1 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: linux-fpga@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 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/fpga/zynq-fpga.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/fpga/zynq-fpga.c b/drivers/fpga/zynq-fpga.c index 96611d424a10..0ac93183d201 100644 --- a/drivers/fpga/zynq-fpga.c +++ b/drivers/fpga/zynq-fpga.c @@ -618,7 +618,7 @@ static int zynq_fpga_probe(struct platform_device *pdev) return 0; } -static int zynq_fpga_remove(struct platform_device *pdev) +static void zynq_fpga_remove(struct platform_device *pdev) { struct zynq_fpga_priv *priv; struct fpga_manager *mgr; @@ -629,8 +629,6 @@ static int zynq_fpga_remove(struct platform_device *pdev) fpga_mgr_unregister(mgr); clk_unprepare(priv->clk); - - return 0; } #ifdef CONFIG_OF @@ -644,7 +642,7 @@ MODULE_DEVICE_TABLE(of, zynq_fpga_of_match); static struct platform_driver zynq_fpga_driver = { .probe = zynq_fpga_probe, - .remove = zynq_fpga_remove, + .remove_new = zynq_fpga_remove, .driver = { .name = "zynq_fpga_manager", .of_match_table = of_match_ptr(zynq_fpga_of_match),