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: 13477347 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:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13477352 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 D598FFF 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-0005gh-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-00DK9e-ID; 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-00DPoc-9F; 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 02/14] scsi: a4000t: Convert to platform remove callback returning void Date: Sun, 3 Dec 2023 17:05:47 +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=2006; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=KzSqkQS+P+EAs50HUDLbAV72d+j525CgjL8snTXrU2M=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbKdanxP0l9h7zpQ2OK3kJQheNg7pwaiKNxvci hEg/uqVqt2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWynWgAKCRCPgPtYfRL+ TrwBB/0RsEXAgHedciw4T23tqItOhKnDusdIzRtyAHIU73fnQWNPaHy2e8L2JZx7ULFm5AdHg9d xmOP9rvuMgepnU/W1W9wj3R1VRLwaNAI55gZHfIyj4iWQZgq4cOuHT+Hi5oqkg0iPEtoiz8PvZn qyQvMk6sCmNvWg41HWGGjX2Mfm9m+Xg+xqmA1JHJzO5IQNUdhG5iUOYVfhgEa3AyNJAPsTUMCEl buSRCEYQsbCjlAe6lWhMBMhLl5ZRDWBwp9MOJJ/bGkCqObPvhBEeQ3vOzOmCDk8juCh5Lu9XPyS 9zMS9hg5qAiA+9cftyQinyKsWhQzUnh3wffyHhKz1hEmYkMa 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/a4000t.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/a4000t.c b/drivers/scsi/a4000t.c index 5e575afce134..e435fc06a624 100644 --- a/drivers/scsi/a4000t.c +++ b/drivers/scsi/a4000t.c @@ -95,7 +95,7 @@ static int __init amiga_a4000t_scsi_probe(struct platform_device *pdev) return -ENODEV; } -static int __exit amiga_a4000t_scsi_remove(struct platform_device *pdev) +static void __exit amiga_a4000t_scsi_remove(struct platform_device *pdev) { struct Scsi_Host *host = platform_get_drvdata(pdev); struct NCR_700_Host_Parameters *hostdata = shost_priv(host); @@ -106,11 +106,10 @@ static int __exit amiga_a4000t_scsi_remove(struct platform_device *pdev) kfree(hostdata); free_irq(host->irq, host); release_mem_region(res->start, resource_size(res)); - return 0; } static struct platform_driver amiga_a4000t_scsi_driver = { - .remove = __exit_p(amiga_a4000t_scsi_remove), + .remove_new = __exit_p(amiga_a4000t_scsi_remove), .driver = { .name = "amiga-a4000t-scsi", }, From patchwork Sun Dec 3 16:05:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13477346 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 46ACBD3 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 1r9oz0-0005gi-Ft; 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-00DK9h-Oe; 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-00DPog-FW; 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: Finn Thain , Michael Schmitz , linux-scsi@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 03/14] scsi: atari: Convert to platform remove callback returning void Date: Sun, 3 Dec 2023 17:05:48 +0100 Message-ID: <27a2b133b1b88a9baf51353c511e93a5027f9602.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=1902; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=sRYZSbRJaYODroZSM3hlQCPdJxwiywJTTKzwkqKHtDI=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbKdb1DJt9dB/DRt3YazdHFnN6+/DpgYxtoVbM JIqcXtie2uJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWynWwAKCRCPgPtYfRL+ Tg5NB/9hEO6MNVQpawOrM78d2dVm+sIGbLyHKvV+KmlXBJmkoKIcqxkdIVkSdOTFfij9Z/qWFoB 6t9XIykVpV5lsPDEYYFr9VCBxreiY2V4wcQokwOIKJEEecOmnKqFNnGzEkUXfoF2RwIZOhTvv4Y tLVdub5HlQAfDTJTCu+N/kFDeMmW4s1GdW4L25BAUXsaRhQ+PjtXDjV5cNeFcY+suM7gE5So16P tIegum0MZo//wiMMJfncrxeSlFMsFoyNw2SqYsBZf4kgRzCdjq+nF8n4s/hxO5HUqcsCWfa+f0+ GAGjcirKlSPHns0BObaNeHaxNdQndARf1bUrWBlwGCnPVvVr 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/atari_scsi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c index d401cf27113a..d99e70914817 100644 --- a/drivers/scsi/atari_scsi.c +++ b/drivers/scsi/atari_scsi.c @@ -865,7 +865,7 @@ static int __init atari_scsi_probe(struct platform_device *pdev) return error; } -static int __exit atari_scsi_remove(struct platform_device *pdev) +static void __exit atari_scsi_remove(struct platform_device *pdev) { struct Scsi_Host *instance = platform_get_drvdata(pdev); @@ -876,11 +876,10 @@ static int __exit atari_scsi_remove(struct platform_device *pdev) scsi_host_put(instance); if (atari_dma_buffer) atari_stram_free(atari_dma_buffer); - return 0; } static struct platform_driver atari_scsi_driver = { - .remove = __exit_p(atari_scsi_remove), + .remove_new = __exit_p(atari_scsi_remove), .driver = { .name = DRV_MODULE_NAME, }, 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: 13477353 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: 13477351 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: 13477355 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: 13477357 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:53 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: 13477354 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 D60CB101 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 1r9oz1-0005hu-By; 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-00DKA2-VY; 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-00DPp0-MW; 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 08/14] scsi: mvme16x: Convert to platform remove callback returning void Date: Sun, 3 Dec 2023 17:05:53 +0100 Message-ID: <1d16e93a498831abd64df8b8cf54fd8872cdd1cd.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=2091; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=OmXRLj7k/75ILKZOY3rC0Oh9OHKObfZIwuESWPXVjtM=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbKdhzT4TJdCtFZXIriXfeFHv1lVktPFGFMiLu bkAX9UTpWeJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWynYQAKCRCPgPtYfRL+ Tn/iB/9Xg/IIJmyxC9vyaE6xj/fjOcyoaynT9o7u5et7oecIyUgT6/ZHC21ctNSyI7vWzu7Rmo0 Kmww1aKA3fRSDbKJFI/VYCSf9a1XEZNOWYxwxQ2vifgF/TnKDivl5V77rqMtREXb43VtDZMydYe VjWR1YXIbKuHbgBLF6x7dakOtVdT2go6bAlaEK7ewYpHw2qdUXffV+071jJ1L4uDTTFRO9obtYb iWjEWjOQJ4fXJeuheVXU/u7IfVbLihojPdHH9AZz0n1OgQtZ/32Anor9561TRdZk7tJDh42V7z/ PIiyvKoxTwL+fTz84Ndjr+1GpmSXxmFRHN2mBH9LBS/ihi+G 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/mvme16x_scsi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/mvme16x_scsi.c b/drivers/scsi/mvme16x_scsi.c index 21d638299ab8..e08a38e2a442 100644 --- a/drivers/scsi/mvme16x_scsi.c +++ b/drivers/scsi/mvme16x_scsi.c @@ -103,7 +103,7 @@ static int mvme16x_probe(struct platform_device *dev) return -ENODEV; } -static int mvme16x_device_remove(struct platform_device *dev) +static void mvme16x_device_remove(struct platform_device *dev) { struct Scsi_Host *host = platform_get_drvdata(dev); struct NCR_700_Host_Parameters *hostdata = shost_priv(host); @@ -120,8 +120,6 @@ static int mvme16x_device_remove(struct platform_device *dev) NCR_700_release(host); kfree(hostdata); free_irq(host->irq, host); - - return 0; } static struct platform_driver mvme16x_scsi_driver = { @@ -129,7 +127,7 @@ static struct platform_driver mvme16x_scsi_driver = { .name = "mvme16x-scsi", }, .probe = mvme16x_probe, - .remove = mvme16x_device_remove, + .remove_new = mvme16x_device_remove, }; static int __init mvme16x_scsi_init(void) From patchwork Sun Dec 3 16:05:54 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: 13477348 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 D23C1CC 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 1r9oz1-0005i4-JP; 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 1r9oz1-00DKA6-6o; 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 1r9oz0-00DPp4-UB; 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 09/14] scsi: qlogicpti: Convert to platform remove callback returning void Date: Sun, 3 Dec 2023 17:05:54 +0100 Message-ID: <8242c07f617fc946aab857c9357f540598fe964e.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=1993; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=DX9lJcChY3CbQVT0Hv59ZpzGpcFqvDKPIdvqtf8GhXo=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbKdibp/lMfWQf/RxHEVZXQ0cP6woZbRj9WksK jlDcwSlxoCJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWynYgAKCRCPgPtYfRL+ ToIOB/9DKjLa9KSKqfZR3a2o0UfL4a9LfJKqX9gAwCG+/C+jDcOzPljdBmF+A9kjCgHfPYPa+eq LQPfCLu5QhZ4wq9BwGPYNDjOg240cfAU1aJIXovGLsmY0meAElXqJDIcFNfSdHL08O3D1oZMq3/ wNphFlz14C32fSzWeT+WyAaEpx+lKntQSX/6OJeES7mvaS68uBmoxoEHm15hQAcAl8OlkMin/Aa Jg8KvnJFsCLAsaRlatext/vijw1ND5PHLYdaHvpHPSmkqvR3lQpmYlkKSaNvfNqDAOBvQN7ZDTG t3P0fa1YkQgyDbmyYXUR7ZqVoN1MOhpShj1rfiHf+dN3v301 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/qlogicpti.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c index 3b95f7a6216f..5d560d9b8944 100644 --- a/drivers/scsi/qlogicpti.c +++ b/drivers/scsi/qlogicpti.c @@ -1409,7 +1409,7 @@ static int qpti_sbus_probe(struct platform_device *op) return -ENODEV; } -static int qpti_sbus_remove(struct platform_device *op) +static void qpti_sbus_remove(struct platform_device *op) { struct qlogicpti *qpti = dev_get_drvdata(&op->dev); @@ -1438,8 +1438,6 @@ static int qpti_sbus_remove(struct platform_device *op) of_iounmap(&op->resource[0], qpti->sreg, sizeof(unsigned char)); scsi_host_put(qpti->qhost); - - return 0; } static const struct of_device_id qpti_match[] = { @@ -1465,7 +1463,7 @@ static struct platform_driver qpti_sbus_driver = { .of_match_table = qpti_match, }, .probe = qpti_sbus_probe, - .remove = qpti_sbus_remove, + .remove_new = qpti_sbus_remove, }; module_platform_driver(qpti_sbus_driver); From patchwork Sun Dec 3 16:05:55 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: 13477356 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 D6712102 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 1r9oz1-0005iF-T1; 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 1r9oz1-00DKAD-G0; 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-00DPp8-6x; 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 10/14] scsi: sgiwd93: Convert to platform remove callback returning void Date: Sun, 3 Dec 2023 17:05:55 +0100 Message-ID: <92114604fd1274073915e515cae15003ff07aa4a.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=1932; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=DW3LG7aglWlZOVUC2OH9y5ea5FON/xeAQBAEDC/idiM=; b=owGbwMvMwMXY3/A7olbonx/jabUkhtSc5ckb3lg4dbtsvjD38jwDg7PyVYE9DewKLEYnY9ck5 e0zaEjsZDRmYWDkYpAVU2Sxb1yTaVUlF9m59t9lmEGsTCBTGLg4BWAirx+y/y/clGXxekUg96r/ DL9aGbgqZhXN5Gx2vV/oVPgtKdyzu3RbmxDv+YmMudOk3Hp5Pl/qNaou6j9+dIGIY/oF9pO3Fsz tXzqFcVpeXdONnee4pD7POvIu8GBJ7feH2suVTL58n5KYVm/Io7R8yf3LMp/79dTjL/epSkg5vO 3s2DlrRWxbhchDhjvTz4XIlf5LvtMcHfDb9Z1094Twc2JVLj+mPtigsS0yJeWUJ3eCz+spMSLzS 9r63V0OBhzJOL9Qr8R9W/rn10eaXnYVlrnu2xj1YAX3KiH+4/rTw6bG57R0np2Q6hQb2td7zfdr 9dR5oQ+v2Non20Vy95WrvKvQWTKRlevSXTU/wbmNDRMTAA== 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/sgiwd93.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/sgiwd93.c b/drivers/scsi/sgiwd93.c index 88e2b5eb9caa..b0bef83db7b6 100644 --- a/drivers/scsi/sgiwd93.c +++ b/drivers/scsi/sgiwd93.c @@ -291,7 +291,7 @@ static int sgiwd93_probe(struct platform_device *pdev) return err; } -static int sgiwd93_remove(struct platform_device *pdev) +static void sgiwd93_remove(struct platform_device *pdev) { struct Scsi_Host *host = platform_get_drvdata(pdev); struct ip22_hostdata *hdata = (struct ip22_hostdata *) host->hostdata; @@ -302,12 +302,11 @@ static int sgiwd93_remove(struct platform_device *pdev) dma_free_noncoherent(&pdev->dev, HPC_DMA_SIZE, hdata->cpu, hdata->dma, DMA_TO_DEVICE); scsi_host_put(host); - return 0; } static struct platform_driver sgiwd93_driver = { .probe = sgiwd93_probe, - .remove = sgiwd93_remove, + .remove_new = sgiwd93_remove, .driver = { .name = "sgiwd93", } 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: 13477349 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:57 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: 13477360 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 83923FD 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 1r9oz2-0005ls-IY; 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-00DKAK-Ui; 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-00DPpG-LP; 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: Finn Thain , Michael Schmitz , linux-scsi@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 12/14] scsi: sun3: Convert to platform remove callback returning void Date: Sun, 3 Dec 2023 17:05:57 +0100 Message-ID: <84239a68fe06143d1d6fed6c9aaae6a4680ead71.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=1917; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=JxRaNdilv9wvaUsCr4lgqeV+yMYMfHAPsBdpJ9bTVOk=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbKdlhUMm9dIKHm13J92ZKJCu52q00nxNUvIM1 ofoEXi5ogGJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWynZQAKCRCPgPtYfRL+ TiAnB/9f9WKlQf4syNLkJGUOKlCN9UjqaE73S+sZxJJzjIeIIn8QC+zjUu3TISOmkefICx/Mun1 1RevZwOG6GEUCzpU3cxITeBfd0vTFkZ/tX+ytc51SHJYtY0vQRN6W3JLVfHVesPBUdiasemvlgM 2FACPGaYmIhSLvnUTmGPCHQvuICU5+MIG5xukjpFupisYZqfJ8Xx3ZcokPalI5gAaDzWRe9QxOB MOinsLiMzhBb2WNV3k4gycI3yHw/tUarTsf00Vv5tR6a6rNelmNH65ikrsG+gulKjg1juQJkwMk zcgqIo2pE4SEGNbX7tZW4GqTGtFUpSQpGEBNQOhDB0jJAiNK 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/sun3_scsi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/sun3_scsi.c b/drivers/scsi/sun3_scsi.c index abf229b847a1..4a8cc2e8238e 100644 --- a/drivers/scsi/sun3_scsi.c +++ b/drivers/scsi/sun3_scsi.c @@ -641,7 +641,7 @@ static int __init sun3_scsi_probe(struct platform_device *pdev) return error; } -static int __exit sun3_scsi_remove(struct platform_device *pdev) +static void __exit sun3_scsi_remove(struct platform_device *pdev) { struct Scsi_Host *instance = platform_get_drvdata(pdev); struct NCR5380_hostdata *hostdata = shost_priv(instance); @@ -654,11 +654,10 @@ static int __exit sun3_scsi_remove(struct platform_device *pdev) if (udc_regs) dvma_free(udc_regs); iounmap(ioaddr); - return 0; } static struct platform_driver sun3_scsi_driver = { - .remove = __exit_p(sun3_scsi_remove), + .remove_new = __exit_p(sun3_scsi_remove), .driver = { .name = DRV_MODULE_NAME, }, 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: 13477359 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", }, From patchwork Sun Dec 3 16:05: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: 13477358 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 1E69BFA 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 1r9oz2-0005oZ-Sw; 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-00DKAR-A4; 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 1r9oz2-00DPpN-18; Sun, 03 Dec 2023 17:06:16 +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 14/14] scsi: sun_esp: Convert to platform remove callback returning void Date: Sun, 3 Dec 2023 17:05:59 +0100 Message-ID: <1d385231c23c2a1e6e7dc1968eb111327386d1f6.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=1963; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=669rSRbFAMDpXl1yfjpgeYu0Rciw+vTbBypz438k1KA=; b=owEBbAGT/pANAwAKAY+A+1h9Ev5OAcsmYgBlbKdo0Yub6ZnaZAtp4ZN/cWTVrqgggbIJu3eJN Wer3bkvQuCJATIEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZWynaAAKCRCPgPtYfRL+ TmFhB/jJJ+J7DR/w8IK7Y65UOYrwQGhY7Nw+ZUk893a3QdA5I8eeo/QBRwCbH9X3URfONXTtjur 7cfWZ//RhdsjXmveq4ARP65BLffj2KuWzqPW86fPsEsr2xASo5Hz99TAUuqXNRzNpGJL+xOKwgG tBLTPDLi3JSvw+g/QsP+8IYpkCSECqwv3u/ET0OG1UuHE7OJz7kJ9ubCQ7OwlLHlkiNKRYhqhe0 R2oLgp3I66cSXtk9D8Ra50jV4T+QVSrLVOFCrGYAlVAldCGuQLBdflIO5DWEhZXIuehwiJr8q35 B8uzUwIj3B5XrkBc2WL7C0EAWRB/vvSu15LsF/gV1SVdlhQ= 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/sun_esp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c index afa9d02a33ec..64a7c2c6c5ff 100644 --- a/drivers/scsi/sun_esp.c +++ b/drivers/scsi/sun_esp.c @@ -550,7 +550,7 @@ static int esp_sbus_probe(struct platform_device *op) return ret; } -static int esp_sbus_remove(struct platform_device *op) +static void esp_sbus_remove(struct platform_device *op) { struct esp *esp = dev_get_drvdata(&op->dev); struct platform_device *dma_of = esp->dma; @@ -581,8 +581,6 @@ static int esp_sbus_remove(struct platform_device *op) dev_set_drvdata(&op->dev, NULL); put_device(&dma_of->dev); - - return 0; } static const struct of_device_id esp_match[] = { @@ -605,7 +603,7 @@ static struct platform_driver esp_sbus_driver = { .of_match_table = esp_match, }, .probe = esp_sbus_probe, - .remove = esp_sbus_remove, + .remove_new = esp_sbus_remove, }; module_platform_driver(esp_sbus_driver);