From patchwork Sun Dec 3 16:05:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 749994 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D24B4CF for ; Sun, 3 Dec 2023 08:06:19 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r9oz0-0005gg-DZ; Sun, 03 Dec 2023 17:06:14 +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 1r9oyz-00DK9b-AA; Sun, 03 Dec 2023 17:06:13 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r9oyz-00DPoY-18; Sun, 03 Dec 2023 17:06:13 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 01/14] scsi: a3000: Convert to platform remove callback returning void Date: Sun, 3 Dec 2023 17:05:46 +0100 Message-ID: <811d180950b76c2d95cd080e3c251757ca011380.1701619134.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2007; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=FWmyBG6+tosrER5aYhbcZFS6iW6Rp5zpoo99vHGj6y8=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbKdZ5mpZm/TAn5pBfmQQEXUh96znGSqOye8Lm CKdnheIJxiJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWynWQAKCRCPgPtYfRL+ Ti6JCACt/hu9m+xc9l8ynuGIyK/CqoUmIUb+jp5LthyeKHHb4bwhXSwiWsnm2QzQrpjPKX9GR8J NHJheZS3LWqj+dqRhBTbb+dC0nxbTHlGH9XsMN3xYU0aDRVSnCM/NRKzgKIHuLrizWpILtNPUNU Rt8mqhWWmvNZu1W5tBGwZ0miMEawxr27FyraZ1xatBqcDPh2N+7ugeMeDs7keZYW1nYGjUvEvJ7 SK4XuSIGQARQQH64FsykVM6wPrl6SrUvjIntt3DJL/nI94mocTLnzXznS48Ik5LupHxI3rESWsm fGKL/qqsP2dzF7fFDFIsnpKyz7hw+HFLs+w7xatMZOpkzhhW 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-scsi@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(). In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour. 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/scsi/a3000.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/a3000.c b/drivers/scsi/a3000.c index c3028726bbe4..378906f77909 100644 --- a/drivers/scsi/a3000.c +++ b/drivers/scsi/a3000.c @@ -282,7 +282,7 @@ static int __init amiga_a3000_scsi_probe(struct platform_device *pdev) return error; } -static int __exit amiga_a3000_scsi_remove(struct platform_device *pdev) +static void __exit amiga_a3000_scsi_remove(struct platform_device *pdev) { struct Scsi_Host *instance = platform_get_drvdata(pdev); struct a3000_hostdata *hdata = shost_priv(instance); @@ -293,11 +293,10 @@ static int __exit amiga_a3000_scsi_remove(struct platform_device *pdev) free_irq(IRQ_AMIGA_PORTS, instance); scsi_host_put(instance); release_mem_region(res->start, resource_size(res)); - return 0; } static struct platform_driver amiga_a3000_scsi_driver = { - .remove = __exit_p(amiga_a3000_scsi_remove), + .remove_new = __exit_p(amiga_a3000_scsi_remove), .driver = { .name = "amiga-a3000-scsi", }, From patchwork Sun Dec 3 16:05:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 749991 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1A57CA for ; Sun, 3 Dec 2023 08:06:19 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r9oz0-0005gj-DZ; Sun, 03 Dec 2023 17:06:14 +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 1r9oyz-00DK9k-VG; Sun, 03 Dec 2023 17:06:13 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r9oyz-00DPok-MH; Sun, 03 Dec 2023 17:06:13 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 04/14] scsi: bvme6000: Convert to platform remove callback returning void Date: Sun, 3 Dec 2023 17:05:49 +0100 Message-ID: <63294479a4e745210c078859afa88904fa0b3be8.1701619134.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1939; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=VV4C+G6hMx/6FssRYN2AFgESyXZ/RflBMYdYp3IpIzk=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbKddQcpjmukbav+hG9LU2IZI5omLEd3RQ/YZR eGo7haRNXWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWynXQAKCRCPgPtYfRL+ TgnrB/9m9dLxzcW1PCX7QJTvKYUhzZmd7/ApihvYoZXA+oznRS6f4WGsQUr5eU/Gh+gzxy2cQoO D/yZFQ+1sCUUNkppL2aBD9v5/GM5nvLtcfvcT6X4a+p9GCKKw9zJW3vvl9mhKRorgfrOC/87cjD Itu2xuDA6bCJ63oz9xiog1QJFp1HwrJeDvQLb8YP6q5VXlce0d5YdA1QFaVwpl+tt0b8BAOqSWw GwoVSg/wstNwnOx7J2QoWkU0wufoWupdeGPLzmcEzeuyodVEt5TQd6ZeD2TdQ+MM10x69k/TvHg e6aspn0smq0XTnMWyJ11wnB1vvJmXso+Ab68rVXg0GuGd+DE 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-scsi@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(). In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour. 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/scsi/bvme6000_scsi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/bvme6000_scsi.c b/drivers/scsi/bvme6000_scsi.c index 8d72b25535c5..f893e9779e9d 100644 --- a/drivers/scsi/bvme6000_scsi.c +++ b/drivers/scsi/bvme6000_scsi.c @@ -89,7 +89,7 @@ bvme6000_probe(struct platform_device *dev) return -ENODEV; } -static int +static void bvme6000_device_remove(struct platform_device *dev) { struct Scsi_Host *host = platform_get_drvdata(dev); @@ -99,8 +99,6 @@ bvme6000_device_remove(struct platform_device *dev) NCR_700_release(host); kfree(hostdata); free_irq(host->irq, host); - - return 0; } static struct platform_driver bvme6000_scsi_driver = { @@ -108,7 +106,7 @@ static struct platform_driver bvme6000_scsi_driver = { .name = "bvme6000-scsi", }, .probe = bvme6000_probe, - .remove = bvme6000_device_remove, + .remove_new = bvme6000_device_remove, }; static int __init bvme6000_scsi_init(void) From patchwork Sun Dec 3 16:05:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 749992 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D39E8FC for ; Sun, 3 Dec 2023 08:06:19 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r9oz0-0005hN-Nt; Sun, 03 Dec 2023 17:06:14 +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 1r9oz0-00DK9n-BF; Sun, 03 Dec 2023 17:06:14 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r9oz0-00DPoo-2I; Sun, 03 Dec 2023 17:06:14 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 05/14] scsi: jazz_esp: Convert to platform remove callback returning void Date: Sun, 3 Dec 2023 17:05:50 +0100 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1944; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=V3JPJOOIOfwLn8zm7K2n2toKLuKsK7g98HVnJbZkmMk=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbKdeKSzYUrXinYcieiKsuk3mEIowYCboTea09 Mghy+RmAEKJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWynXgAKCRCPgPtYfRL+ TgW7B/47F88dCFPo2y5c4J9fIg5p8yNTSqZd8tnwGRPnAjqUoyHfmw9Wke3X0yXSRUraPc3Q9Hc RV3KxC6BqbTVyMJMKnYcSL2knpI7iIcB7DKMAPHN0VnUSu2WDwnjHJloY+oOA6QgwtmvCxBEejb icVY/89EXSauP3wQApEPZOAF57zW3j/9ayrAqPiUFOqzW1DDDdqvPTN5XMZeP1p0ia86CVBMRyk 9STMsmQl2TYenhOlqjYlAauLdbMD7goHK3cYfi0rEzlkp0l9wcjAN3ffitJhaenCYg1Y13ay33v HIfPeSvgdb+TWVYzDwdcRZuLSIyAG108KUKkzZMZFB8Jcmjk 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-scsi@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(). In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour. 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/scsi/jazz_esp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c index 0c842fb29aa0..494a671fb556 100644 --- a/drivers/scsi/jazz_esp.c +++ b/drivers/scsi/jazz_esp.c @@ -176,7 +176,7 @@ static int esp_jazz_probe(struct platform_device *dev) return err; } -static int esp_jazz_remove(struct platform_device *dev) +static void esp_jazz_remove(struct platform_device *dev) { struct esp *esp = dev_get_drvdata(&dev->dev); unsigned int irq = esp->host->irq; @@ -189,8 +189,6 @@ static int esp_jazz_remove(struct platform_device *dev) esp->command_block_dma); scsi_host_put(esp->host); - - return 0; } /* work with hotplug and coldplug */ @@ -198,7 +196,7 @@ MODULE_ALIAS("platform:jazz_esp"); static struct platform_driver esp_jazz_driver = { .probe = esp_jazz_probe, - .remove = esp_jazz_remove, + .remove_new = esp_jazz_remove, .driver = { .name = "jazz_esp", }, From patchwork Sun Dec 3 16:05:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 749990 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6F8B106 for ; Sun, 3 Dec 2023 08:06:19 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r9oz0-0005hW-Ts; Sun, 03 Dec 2023 17:06:14 +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 1r9oz0-00DK9t-HP; Sun, 03 Dec 2023 17:06:14 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r9oz0-00DPos-7z; Sun, 03 Dec 2023 17:06:14 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 06/14] scsi: mac_esp: Convert to platform remove callback returning void Date: Sun, 3 Dec 2023 17:05:51 +0100 Message-ID: <9013c84059b8ccd6a5c8305aa35cfdfa314ba74c.1701619134.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1844; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=eq33+WGghO/SVL/B/pYvTYvDw2vusngjGxzoUEKQznU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbKdfLZ0A/rjpy9pmNHFB+dqZFK4ehkn4BgppL ryV9cx9o2mJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWynXwAKCRCPgPtYfRL+ TjJXB/41IUjR2sHCMUoNtVMo0PNWFhOLbwYU12SN32jSCIVotYD47+sBW+aDBvHu6auXf9CjUIW AEATbCOaNugGAus4luz5I/jmw2Nvbr8CH5GltmcpA0RU/zzDpGXnt4qNqjahxa7V05aewvX5id1 biEbgRG99Mwz0tHdaI9x7PL3Z+MNgx4oH5Y22QT6tPyuI/Kqh+HliyoIquxYsbZGfIMYDIz1kdJ DSzzHd2aRxW3b7j+tnCHUfdH28qFNM33vEVZ9AKEAgH2w2A+mdgN08nsxjh10HRZr7G8mrhA1U9 rvU5jLqqlEzP9dVmbN1YZdgWlKR04Du2RMBvPbsWHct4Z0vx 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-scsi@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(). In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour. 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/scsi/mac_esp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/mac_esp.c b/drivers/scsi/mac_esp.c index 3f0061b00494..187ae0a65d40 100644 --- a/drivers/scsi/mac_esp.c +++ b/drivers/scsi/mac_esp.c @@ -407,7 +407,7 @@ static int esp_mac_probe(struct platform_device *dev) return err; } -static int esp_mac_remove(struct platform_device *dev) +static void esp_mac_remove(struct platform_device *dev) { struct mac_esp_priv *mep = platform_get_drvdata(dev); struct esp *esp = mep->esp; @@ -428,13 +428,11 @@ static int esp_mac_remove(struct platform_device *dev) kfree(esp->command_block); scsi_host_put(esp->host); - - return 0; } static struct platform_driver esp_mac_driver = { .probe = esp_mac_probe, - .remove = esp_mac_remove, + .remove_new = esp_mac_remove, .driver = { .name = DRV_MODULE_NAME, }, From patchwork Sun Dec 3 16:05:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 749989 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C816113 for ; Sun, 3 Dec 2023 08:06:21 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r9oz1-0005hk-5O; Sun, 03 Dec 2023 17:06:15 +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 1r9oz0-00DK9y-OY; Sun, 03 Dec 2023 17:06:14 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r9oz0-00DPow-FG; Sun, 03 Dec 2023 17:06:14 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: Finn Thain , Michael Schmitz , linux-scsi@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 07/14] scsi: mac: Convert to platform remove callback returning void Date: Sun, 3 Dec 2023 17:05:52 +0100 Message-ID: <89ce161dad52d99df07135531512ccecb7f25d14.1701619134.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1879; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=+LAH4AA0RrqXbnfMQIUBKTSBhjrcodlYO5mcqrnMDPQ=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbKdgVBHV894GQAFtGORXe+ic77vux7kj7otYh VEWYkYmWwaJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWynYAAKCRCPgPtYfRL+ Ti28CAC1ecVDoF4232TAOHwjXEEWk3skYG1vPOsvJ0u6KwTO2noX1zlaLi9G43WcT0N5BGo6GRO FVROJa331uv1CSZZkDEqkuWSslzReqKdKykmCvpNxsFuRh2Y8TMnQsVUTGz7Z27kn9TRpZL6nL/ NWeC6uuWMsLneA13HazPS3qxYt8nwY9HWmdI7k1n0atakpUH8q0/+EtKtmQ/3wkZWzupqf4nZ4s 2iv49+toUx/xB5Y3d7iAoA5vfdrkQY5B3aYPlY1g6Bjmuaer6pTZRBNcuDW23xJBNfOHcFi2ujO IyKBvRZhdt10iMYFFZe49Q5bYZi4FheA9Eon7Q0yABPmx77d 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-scsi@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(). In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour. 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/scsi/mac_scsi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/mac_scsi.c b/drivers/scsi/mac_scsi.c index 2e511697fce3..181f16899fdc 100644 --- a/drivers/scsi/mac_scsi.c +++ b/drivers/scsi/mac_scsi.c @@ -523,7 +523,7 @@ static int __init mac_scsi_probe(struct platform_device *pdev) return error; } -static int __exit mac_scsi_remove(struct platform_device *pdev) +static void __exit mac_scsi_remove(struct platform_device *pdev) { struct Scsi_Host *instance = platform_get_drvdata(pdev); @@ -532,11 +532,10 @@ static int __exit mac_scsi_remove(struct platform_device *pdev) free_irq(instance->irq, instance); NCR5380_exit(instance); scsi_host_put(instance); - return 0; } static struct platform_driver mac_scsi_driver = { - .remove = __exit_p(mac_scsi_remove), + .remove_new = __exit_p(mac_scsi_remove), .driver = { .name = DRV_MODULE_NAME, }, From patchwork Sun Dec 3 16:05:56 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: 749993 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82D27F3 for ; Sun, 3 Dec 2023 08:06:20 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r9oz2-0005j8-8M; Sun, 03 Dec 2023 17:06:16 +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 1r9oz1-00DKAH-Mh; Sun, 03 Dec 2023 17:06:15 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r9oz1-00DPpC-Df; Sun, 03 Dec 2023 17:06:15 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 11/14] scsi: sni_53c710: Convert to platform remove callback returning void Date: Sun, 3 Dec 2023 17:05:56 +0100 Message-ID: <2f4b7366ca00a107a9595514795e909e632980da.1701619134.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1928; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=JVXR/wGLKd4oXjMe20bO4gGzC6ZHjdQOxID8arexqvs=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbKdkPz0RcmVpObAkOKaKHE/StzZioMOpdiaEJ ZY5QYIbaj+JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWynZAAKCRCPgPtYfRL+ TvozCACJXUkTkuz7361IrfRWYT0d6c3g4fbsQoD6zZF+vyXmYYfGuvzPmoHhRTXIlo1NNUvpoxK xdA0ZfCG9+XfFCgNlbxYw1SgHvq2B6nQ2+yotgG5RSUpXXtv7Aix8EqJb2lpAkccH8aeKnYcDWc VHD3aay2tA7k5SJiPzeLBFV5aLNN29sqdi/e8lIAB7s7BSFcUwZp4XtKJV8Kfdu3eAZUU7647Ff mMXQzMDFIfMZ0rlH99Nu+TsUbu1MBnw+F+iLsOKmcwl2yE8pq1sep84xt+dJQaEj7xd0EiDDoP5 x8y1EDNA1q4dxJDcVrbMwDU1LJ99SwlsqRU3Auzzpo0rHxsO 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-scsi@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(). In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour. 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/scsi/sni_53c710.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/sni_53c710.c b/drivers/scsi/sni_53c710.c index 678651b9b4dd..9df1c90a24c1 100644 --- a/drivers/scsi/sni_53c710.c +++ b/drivers/scsi/sni_53c710.c @@ -104,7 +104,7 @@ static int snirm710_probe(struct platform_device *dev) return -ENODEV; } -static int snirm710_driver_remove(struct platform_device *dev) +static void snirm710_driver_remove(struct platform_device *dev) { struct Scsi_Host *host = dev_get_drvdata(&dev->dev); struct NCR_700_Host_Parameters *hostdata = @@ -115,13 +115,11 @@ static int snirm710_driver_remove(struct platform_device *dev) free_irq(host->irq, host); iounmap(hostdata->base); kfree(hostdata); - - return 0; } static struct platform_driver snirm710_driver = { .probe = snirm710_probe, - .remove = snirm710_driver_remove, + .remove_new = snirm710_driver_remove, .driver = { .name = "snirm_53c710", }, From patchwork Sun Dec 3 16:05:58 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: 749988 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C231410E for ; Sun, 3 Dec 2023 08:06:20 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r9oz2-0005nP-NZ; Sun, 03 Dec 2023 17:06:16 +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 1r9oz2-00DKAO-58; Sun, 03 Dec 2023 17:06:16 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1r9oz1-00DPpK-SA; Sun, 03 Dec 2023 17:06:15 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 13/14] scsi: sun3x_esp: Convert to platform remove callback returning void Date: Sun, 3 Dec 2023 17:05:58 +0100 Message-ID: <5010d1a4f3d77eaa1114fa254c343c4f23313901.1701619134.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1883; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=b8kdc5NUtC8q0GXD2i5QPt7FoloXN5G7rEJdkurrL5I=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbKdnsppi63Ssn9wP43fZFWIrXiD6qeZrCnMye Bs8MyJHZWSJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWynZwAKCRCPgPtYfRL+ TraZCACAFmJv5gpY1Rkz7QjGeo/e44+YlAYGYsp0xYBvuHNm3IHAr6M1C6Hm2qNicdx5IvphSyq CMA5mIRjAY+DGcAInseByGmggTe0FRv94MkjkowzOMnoqCTK8fPyG+oTBZF0EHamIVldz1iq4JN 6f9JYolAl7KiGQC4HG5JYKTQgKCLkUGhDelBCFKdb3xosc1F/GjOVq1HdFKzmOwawuvsEgZgG/H /BB/8MFToxdsdQYHJj/U6ynQ+3rwdVGScYskLwpeAppOIRCSq/9zdiUs7VqnpkbKZEZ6jMdEw/k a4HhEGZR4oTPXfb3rdubzgC3i32qS4E4F/PpH+s7hPh+Q5P1 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-scsi@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(). In the error path emit an error message replacing the (less useful) message by the core. Apart from the improved error message there is no change in behaviour. 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/scsi/sun3x_esp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/sun3x_esp.c b/drivers/scsi/sun3x_esp.c index 30f67cbf4a7a..09219c362acc 100644 --- a/drivers/scsi/sun3x_esp.c +++ b/drivers/scsi/sun3x_esp.c @@ -243,7 +243,7 @@ static int esp_sun3x_probe(struct platform_device *dev) return err; } -static int esp_sun3x_remove(struct platform_device *dev) +static void esp_sun3x_remove(struct platform_device *dev) { struct esp *esp = dev_get_drvdata(&dev->dev); unsigned int irq = esp->host->irq; @@ -261,13 +261,11 @@ static int esp_sun3x_remove(struct platform_device *dev) esp->command_block_dma); scsi_host_put(esp->host); - - return 0; } static struct platform_driver esp_sun3x_driver = { .probe = esp_sun3x_probe, - .remove = esp_sun3x_remove, + .remove_new = esp_sun3x_remove, .driver = { .name = "sun3x_esp", },