linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/42] crypto: sun4i-ss - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20 10:10   ` Andre Przywara
                     ` (2 more replies)
  2023-10-20  7:55 ` [PATCH 02/42] crypto: sun8i-ce " Uwe Kleine-König
                   ` (15 subsequent siblings)
  16 siblings, 3 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Corentin Labbe, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Jonathan Corbet, Rob Herring, linux-crypto, linux-arm-kernel,
	linux-sunxi, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
index 3bcfcfc37084..ba80878e2df5 100644
--- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
+++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
@@ -509,7 +509,7 @@ static int sun4i_ss_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int sun4i_ss_remove(struct platform_device *pdev)
+static void sun4i_ss_remove(struct platform_device *pdev)
 {
 	int i;
 	struct sun4i_ss_ctx *ss = platform_get_drvdata(pdev);
@@ -529,7 +529,6 @@ static int sun4i_ss_remove(struct platform_device *pdev)
 	}
 
 	sun4i_ss_pm_exit(ss);
-	return 0;
 }
 
 static const struct of_device_id a20ss_crypto_of_match_table[] = {
@@ -545,7 +544,7 @@ MODULE_DEVICE_TABLE(of, a20ss_crypto_of_match_table);
 
 static struct platform_driver sun4i_ss_driver = {
 	.probe          = sun4i_ss_probe,
-	.remove         = sun4i_ss_remove,
+	.remove_new     = sun4i_ss_remove,
 	.driver         = {
 		.name           = "sun4i-ss",
 		.pm		= &sun4i_ss_pm_ops,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 02/42] crypto: sun8i-ce - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
  2023-10-20  7:55 ` [PATCH 01/42] crypto: sun4i-ss - Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20 10:12   ` Andre Przywara
                     ` (2 more replies)
  2023-10-20  7:55 ` [PATCH 03/42] crypto: sun8i-ss " Uwe Kleine-König
                   ` (14 subsequent siblings)
  16 siblings, 3 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Corentin Labbe, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Rob Herring, Jonathan Corbet, linux-crypto, linux-arm-kernel,
	linux-sunxi, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
index d4ccd5254280..1741758e03eb 100644
--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
@@ -1071,7 +1071,7 @@ static int sun8i_ce_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int sun8i_ce_remove(struct platform_device *pdev)
+static void sun8i_ce_remove(struct platform_device *pdev)
 {
 	struct sun8i_ce_dev *ce = platform_get_drvdata(pdev);
 
@@ -1088,7 +1088,6 @@ static int sun8i_ce_remove(struct platform_device *pdev)
 	sun8i_ce_free_chanlist(ce, MAXFLOW - 1);
 
 	sun8i_ce_pm_exit(ce);
-	return 0;
 }
 
 static const struct of_device_id sun8i_ce_crypto_of_match_table[] = {
@@ -1110,7 +1109,7 @@ MODULE_DEVICE_TABLE(of, sun8i_ce_crypto_of_match_table);
 
 static struct platform_driver sun8i_ce_driver = {
 	.probe		 = sun8i_ce_probe,
-	.remove		 = sun8i_ce_remove,
+	.remove_new	 = sun8i_ce_remove,
 	.driver		 = {
 		.name		= "sun8i-ce",
 		.pm		= &sun8i_ce_pm_ops,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 03/42] crypto: sun8i-ss - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
  2023-10-20  7:55 ` [PATCH 01/42] crypto: sun4i-ss - Convert to platform remove callback returning void Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 02/42] crypto: sun8i-ce " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20 10:12   ` Andre Przywara
                     ` (2 more replies)
  2023-10-20  7:55 ` [PATCH 06/42] crypto: aspeed-acry " Uwe Kleine-König
                   ` (13 subsequent siblings)
  16 siblings, 3 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Corentin Labbe, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Jonathan Corbet, Rob Herring, linux-crypto, linux-arm-kernel,
	linux-sunxi, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
index 4a9587285c04..f14c60359d19 100644
--- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
+++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
@@ -908,7 +908,7 @@ static int sun8i_ss_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int sun8i_ss_remove(struct platform_device *pdev)
+static void sun8i_ss_remove(struct platform_device *pdev)
 {
 	struct sun8i_ss_dev *ss = platform_get_drvdata(pdev);
 
@@ -921,8 +921,6 @@ static int sun8i_ss_remove(struct platform_device *pdev)
 	sun8i_ss_free_flows(ss, MAXFLOW - 1);
 
 	sun8i_ss_pm_exit(ss);
-
-	return 0;
 }
 
 static const struct of_device_id sun8i_ss_crypto_of_match_table[] = {
@@ -936,7 +934,7 @@ MODULE_DEVICE_TABLE(of, sun8i_ss_crypto_of_match_table);
 
 static struct platform_driver sun8i_ss_driver = {
 	.probe		 = sun8i_ss_probe,
-	.remove		 = sun8i_ss_remove,
+	.remove_new	 = sun8i_ss_remove,
 	.driver		 = {
 		.name		= "sun8i-ss",
 		.pm             = &sun8i_ss_pm_ops,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 06/42] crypto: aspeed-acry - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
                   ` (2 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 03/42] crypto: sun8i-ss " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-23  2:35   ` Andrew Jeffery
  2023-10-20  7:55 ` [PATCH 07/42] crypto: aspeed-hace " Uwe Kleine-König
                   ` (12 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Neal Liu, Joel Stanley, Andrew Jeffery, linux-aspeed,
	linux-crypto, linux-arm-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/aspeed/aspeed-acry.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/aspeed/aspeed-acry.c b/drivers/crypto/aspeed/aspeed-acry.c
index 247c568aa8df..b4613bd4ad96 100644
--- a/drivers/crypto/aspeed/aspeed-acry.c
+++ b/drivers/crypto/aspeed/aspeed-acry.c
@@ -794,7 +794,7 @@ static int aspeed_acry_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static int aspeed_acry_remove(struct platform_device *pdev)
+static void aspeed_acry_remove(struct platform_device *pdev)
 {
 	struct aspeed_acry_dev *acry_dev = platform_get_drvdata(pdev);
 
@@ -802,15 +802,13 @@ static int aspeed_acry_remove(struct platform_device *pdev)
 	crypto_engine_exit(acry_dev->crypt_engine_rsa);
 	tasklet_kill(&acry_dev->done_task);
 	clk_disable_unprepare(acry_dev->clk);
-
-	return 0;
 }
 
 MODULE_DEVICE_TABLE(of, aspeed_acry_of_matches);
 
 static struct platform_driver aspeed_acry_driver = {
 	.probe		= aspeed_acry_probe,
-	.remove		= aspeed_acry_remove,
+	.remove_new	= aspeed_acry_remove,
 	.driver		= {
 		.name   = KBUILD_MODNAME,
 		.of_match_table = aspeed_acry_of_matches,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 07/42] crypto: aspeed-hace - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
                   ` (3 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 06/42] crypto: aspeed-acry " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-23  2:36   ` Andrew Jeffery
  2023-10-20  7:55 ` [PATCH 08/42] crypto: atmel-aes " Uwe Kleine-König
                   ` (11 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Neal Liu, Joel Stanley, Andrew Jeffery, linux-aspeed,
	linux-crypto, linux-arm-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/aspeed/aspeed-hace.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/aspeed/aspeed-hace.c b/drivers/crypto/aspeed/aspeed-hace.c
index d9da04fb816e..062f2a66dd23 100644
--- a/drivers/crypto/aspeed/aspeed-hace.c
+++ b/drivers/crypto/aspeed/aspeed-hace.c
@@ -245,7 +245,7 @@ static int aspeed_hace_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static int aspeed_hace_remove(struct platform_device *pdev)
+static void aspeed_hace_remove(struct platform_device *pdev)
 {
 	struct aspeed_hace_dev *hace_dev = platform_get_drvdata(pdev);
 	struct aspeed_engine_crypto *crypto_engine = &hace_dev->crypto_engine;
@@ -260,15 +260,13 @@ static int aspeed_hace_remove(struct platform_device *pdev)
 	tasklet_kill(&crypto_engine->done_task);
 
 	clk_disable_unprepare(hace_dev->clk);
-
-	return 0;
 }
 
 MODULE_DEVICE_TABLE(of, aspeed_hace_of_matches);
 
 static struct platform_driver aspeed_hace_driver = {
 	.probe		= aspeed_hace_probe,
-	.remove		= aspeed_hace_remove,
+	.remove_new	= aspeed_hace_remove,
 	.driver         = {
 		.name   = KBUILD_MODNAME,
 		.of_match_table = aspeed_hace_of_matches,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 08/42] crypto: atmel-aes - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
                   ` (4 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 07/42] crypto: aspeed-hace " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  8:49   ` Hari.PrasathGE
  2023-10-20  7:55 ` [PATCH 09/42] crypto: atmel-sha " Uwe Kleine-König
                   ` (10 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Alexandre Belloni, Claudiu Beznea, linux-crypto, kernel,
	linux-arm-kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/atmel-aes.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
index 55b5f577b01c..d1d93e897892 100644
--- a/drivers/crypto/atmel-aes.c
+++ b/drivers/crypto/atmel-aes.c
@@ -2648,7 +2648,7 @@ static int atmel_aes_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int atmel_aes_remove(struct platform_device *pdev)
+static void atmel_aes_remove(struct platform_device *pdev)
 {
 	struct atmel_aes_dev *aes_dd;
 
@@ -2667,13 +2667,11 @@ static int atmel_aes_remove(struct platform_device *pdev)
 	atmel_aes_buff_cleanup(aes_dd);
 
 	clk_unprepare(aes_dd->iclk);
-
-	return 0;
 }
 
 static struct platform_driver atmel_aes_driver = {
 	.probe		= atmel_aes_probe,
-	.remove		= atmel_aes_remove,
+	.remove_new	= atmel_aes_remove,
 	.driver		= {
 		.name	= "atmel_aes",
 		.of_match_table = atmel_aes_dt_ids,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 09/42] crypto: atmel-sha - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
                   ` (5 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 08/42] crypto: atmel-aes " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 10/42] crypto: atmel-tdes " Uwe Kleine-König
                   ` (9 subsequent siblings)
  16 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Alexandre Belloni, Claudiu Beznea, linux-crypto, kernel,
	linux-arm-kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/atmel-sha.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index 3622120add62..ad45af288ece 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -2680,7 +2680,7 @@ static int atmel_sha_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int atmel_sha_remove(struct platform_device *pdev)
+static void atmel_sha_remove(struct platform_device *pdev)
 {
 	struct atmel_sha_dev *sha_dd = platform_get_drvdata(pdev);
 
@@ -2697,13 +2697,11 @@ static int atmel_sha_remove(struct platform_device *pdev)
 		atmel_sha_dma_cleanup(sha_dd);
 
 	clk_unprepare(sha_dd->iclk);
-
-	return 0;
 }
 
 static struct platform_driver atmel_sha_driver = {
 	.probe		= atmel_sha_probe,
-	.remove		= atmel_sha_remove,
+	.remove_new	= atmel_sha_remove,
 	.driver		= {
 		.name	= "atmel_sha",
 		.of_match_table	= atmel_sha_dt_ids,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 10/42] crypto: atmel-tdes - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
                   ` (6 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 09/42] crypto: atmel-sha " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 16/42] crypto: exynos-rng " Uwe Kleine-König
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Alexandre Belloni, Claudiu Beznea, linux-crypto, kernel,
	linux-arm-kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/atmel-tdes.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/atmel-tdes.c b/drivers/crypto/atmel-tdes.c
index 099b32a10dd7..27b7000e25bc 100644
--- a/drivers/crypto/atmel-tdes.c
+++ b/drivers/crypto/atmel-tdes.c
@@ -1246,7 +1246,7 @@ static int atmel_tdes_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int atmel_tdes_remove(struct platform_device *pdev)
+static void atmel_tdes_remove(struct platform_device *pdev)
 {
 	struct atmel_tdes_dev *tdes_dd = platform_get_drvdata(pdev);
 
@@ -1263,13 +1263,11 @@ static int atmel_tdes_remove(struct platform_device *pdev)
 		atmel_tdes_dma_cleanup(tdes_dd);
 
 	atmel_tdes_buff_cleanup(tdes_dd);
-
-	return 0;
 }
 
 static struct platform_driver atmel_tdes_driver = {
 	.probe		= atmel_tdes_probe,
-	.remove		= atmel_tdes_remove,
+	.remove_new	= atmel_tdes_remove,
 	.driver		= {
 		.name	= "atmel_tdes",
 		.of_match_table = atmel_tdes_dt_ids,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 16/42] crypto: exynos-rng - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
                   ` (7 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 10/42] crypto: atmel-tdes " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  8:18   ` Krzysztof Kozlowski
  2023-10-24 21:52   ` Andi Shyti
  2023-10-20  7:55 ` [PATCH 17/42] crypto: gemini/sl3516-ce " Uwe Kleine-König
                   ` (7 subsequent siblings)
  16 siblings, 2 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Krzysztof Kozlowski, Alim Akhtar, linux-crypto, linux-samsung-soc,
	linux-arm-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/exynos-rng.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/exynos-rng.c b/drivers/crypto/exynos-rng.c
index 5d60a4bcb511..0dd8baf16cb4 100644
--- a/drivers/crypto/exynos-rng.c
+++ b/drivers/crypto/exynos-rng.c
@@ -306,13 +306,11 @@ static int exynos_rng_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int exynos_rng_remove(struct platform_device *pdev)
+static void exynos_rng_remove(struct platform_device *pdev)
 {
 	crypto_unregister_rng(&exynos_rng_alg);
 
 	exynos_rng_dev = NULL;
-
-	return 0;
 }
 
 static int __maybe_unused exynos_rng_suspend(struct device *dev)
@@ -391,7 +389,7 @@ static struct platform_driver exynos_rng_driver = {
 		.of_match_table = exynos_rng_dt_match,
 	},
 	.probe		= exynos_rng_probe,
-	.remove		= exynos_rng_remove,
+	.remove_new	= exynos_rng_remove,
 };
 
 module_platform_driver(exynos_rng_driver);
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 17/42] crypto: gemini/sl3516-ce - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
                   ` (8 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 16/42] crypto: exynos-rng " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-25 13:30   ` Corentin LABBE
  2023-10-20  7:55 ` [PATCH 22/42] crypto: intel/ixp4xx-crypto " Uwe Kleine-König
                   ` (6 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Hans Ulli Kroll, Linus Walleij, Corentin Labbe, linux-arm-kernel,
	linux-crypto, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/gemini/sl3516-ce-core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/gemini/sl3516-ce-core.c b/drivers/crypto/gemini/sl3516-ce-core.c
index 0f43c6e39bb9..1d1a889599bb 100644
--- a/drivers/crypto/gemini/sl3516-ce-core.c
+++ b/drivers/crypto/gemini/sl3516-ce-core.c
@@ -505,7 +505,7 @@ static int sl3516_ce_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int sl3516_ce_remove(struct platform_device *pdev)
+static void sl3516_ce_remove(struct platform_device *pdev)
 {
 	struct sl3516_ce_dev *ce = platform_get_drvdata(pdev);
 
@@ -518,8 +518,6 @@ static int sl3516_ce_remove(struct platform_device *pdev)
 #ifdef CONFIG_CRYPTO_DEV_SL3516_DEBUG
 	debugfs_remove_recursive(ce->dbgfs_dir);
 #endif
-
-	return 0;
 }
 
 static const struct of_device_id sl3516_ce_crypto_of_match_table[] = {
@@ -530,7 +528,7 @@ MODULE_DEVICE_TABLE(of, sl3516_ce_crypto_of_match_table);
 
 static struct platform_driver sl3516_ce_driver = {
 	.probe		 = sl3516_ce_probe,
-	.remove		 = sl3516_ce_remove,
+	.remove_new	 = sl3516_ce_remove,
 	.driver		 = {
 		.name		= "sl3516-crypto",
 		.pm		= &sl3516_ce_pm_ops,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 22/42] crypto: intel/ixp4xx-crypto - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
                   ` (9 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 17/42] crypto: gemini/sl3516-ce " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-25 13:30   ` Corentin LABBE
  2023-10-20  7:55 ` [PATCH 27/42] crypto: mxs-dcp " Uwe Kleine-König
                   ` (5 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Linus Walleij, Imre Kaloz, Corentin Labbe, linux-arm-kernel,
	linux-crypto, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c b/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c
index 4a18095ae5d8..f8a77bff8844 100644
--- a/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c
+++ b/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c
@@ -1563,7 +1563,7 @@ static int ixp_crypto_probe(struct platform_device *_pdev)
 	return 0;
 }
 
-static int ixp_crypto_remove(struct platform_device *pdev)
+static void ixp_crypto_remove(struct platform_device *pdev)
 {
 	int num = ARRAY_SIZE(ixp4xx_algos);
 	int i;
@@ -1578,8 +1578,6 @@ static int ixp_crypto_remove(struct platform_device *pdev)
 			crypto_unregister_skcipher(&ixp4xx_algos[i].crypto);
 	}
 	release_ixp_crypto(&pdev->dev);
-
-	return 0;
 }
 static const struct of_device_id ixp4xx_crypto_of_match[] = {
 	{
@@ -1590,7 +1588,7 @@ static const struct of_device_id ixp4xx_crypto_of_match[] = {
 
 static struct platform_driver ixp_crypto_driver = {
 	.probe = ixp_crypto_probe,
-	.remove = ixp_crypto_remove,
+	.remove_new = ixp_crypto_remove,
 	.driver = {
 		.name = "ixp4xx_crypto",
 		.of_match_table = ixp4xx_crypto_of_match,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 27/42] crypto: mxs-dcp - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
                   ` (10 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 22/42] crypto: intel/ixp4xx-crypto " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 34/42] crypto: rockchip/rk3288 " Uwe Kleine-König
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Shawn Guo, Sascha Hauer, Fabio Estevam, NXP Linux Team,
	linux-crypto, linux-arm-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/mxs-dcp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/mxs-dcp.c b/drivers/crypto/mxs-dcp.c
index f6b7bce0e656..d41efddbc772 100644
--- a/drivers/crypto/mxs-dcp.c
+++ b/drivers/crypto/mxs-dcp.c
@@ -1131,7 +1131,7 @@ static int mxs_dcp_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int mxs_dcp_remove(struct platform_device *pdev)
+static void mxs_dcp_remove(struct platform_device *pdev)
 {
 	struct dcp *sdcp = platform_get_drvdata(pdev);
 
@@ -1150,8 +1150,6 @@ static int mxs_dcp_remove(struct platform_device *pdev)
 	platform_set_drvdata(pdev, NULL);
 
 	global_sdcp = NULL;
-
-	return 0;
 }
 
 static const struct of_device_id mxs_dcp_dt_ids[] = {
@@ -1164,7 +1162,7 @@ MODULE_DEVICE_TABLE(of, mxs_dcp_dt_ids);
 
 static struct platform_driver mxs_dcp_driver = {
 	.probe	= mxs_dcp_probe,
-	.remove	= mxs_dcp_remove,
+	.remove_new = mxs_dcp_remove,
 	.driver	= {
 		.name		= "mxs-dcp",
 		.of_match_table	= mxs_dcp_dt_ids,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 34/42] crypto: rockchip/rk3288 - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
                   ` (11 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 27/42] crypto: mxs-dcp " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  8:13   ` Heiko Stübner
  2023-10-25 13:31   ` Corentin LABBE
  2023-10-20  7:56 ` [PATCH 38/42] crypto: stm32/crc32 " Uwe Kleine-König
                   ` (3 subsequent siblings)
  16 siblings, 2 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Corentin Labbe, Heiko Stuebner, linux-crypto, linux-arm-kernel,
	linux-rockchip, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/rockchip/rk3288_crypto.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/rockchip/rk3288_crypto.c b/drivers/crypto/rockchip/rk3288_crypto.c
index 77d5705a5d96..70edf40bc523 100644
--- a/drivers/crypto/rockchip/rk3288_crypto.c
+++ b/drivers/crypto/rockchip/rk3288_crypto.c
@@ -405,7 +405,7 @@ static int rk_crypto_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int rk_crypto_remove(struct platform_device *pdev)
+static void rk_crypto_remove(struct platform_device *pdev)
 {
 	struct rk_crypto_info *crypto_tmp = platform_get_drvdata(pdev);
 	struct rk_crypto_info *first;
@@ -424,12 +424,11 @@ static int rk_crypto_remove(struct platform_device *pdev)
 	}
 	rk_crypto_pm_exit(crypto_tmp);
 	crypto_engine_exit(crypto_tmp->engine);
-	return 0;
 }
 
 static struct platform_driver crypto_driver = {
 	.probe		= rk_crypto_probe,
-	.remove		= rk_crypto_remove,
+	.remove_new	= rk_crypto_remove,
 	.driver		= {
 		.name	= "rk3288-crypto",
 		.pm		= &rk_crypto_pm_ops,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 38/42] crypto: stm32/crc32 - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
                   ` (12 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 34/42] crypto: rockchip/rk3288 " Uwe Kleine-König
@ 2023-10-20  7:56 ` Uwe Kleine-König
  2023-10-20  7:56 ` [PATCH 39/42] crypto: stm32/cryp " Uwe Kleine-König
                   ` (2 subsequent siblings)
  16 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:56 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Maxime Coquelin, Alexandre Torgue, linux-crypto, linux-stm32,
	linux-arm-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

The driver adapted here suffered from this wrong assumption and had an
error paths resulting in resource leaks.

If pm_runtime_get() fails, the other resources held by the device must
still be freed. Only clk_disable() should be skipped as the
pm_runtime_get() failed to call clk_enable().

After this change the remove function returns zero unconditionally and
can trivially be converted to the prototype required for .remove_new().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/stm32/stm32-crc32.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/crypto/stm32/stm32-crc32.c b/drivers/crypto/stm32/stm32-crc32.c
index 90a920e7f664..5d1067c8cb0d 100644
--- a/drivers/crypto/stm32/stm32-crc32.c
+++ b/drivers/crypto/stm32/stm32-crc32.c
@@ -379,16 +379,11 @@ static int stm32_crc_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int stm32_crc_remove(struct platform_device *pdev)
+static void stm32_crc_remove(struct platform_device *pdev)
 {
 	struct stm32_crc *crc = platform_get_drvdata(pdev);
 	int ret = pm_runtime_get_sync(crc->dev);
 
-	if (ret < 0) {
-		pm_runtime_put_noidle(crc->dev);
-		return ret;
-	}
-
 	spin_lock(&crc_list.lock);
 	list_del(&crc->list);
 	spin_unlock(&crc_list.lock);
@@ -401,9 +396,9 @@ static int stm32_crc_remove(struct platform_device *pdev)
 	pm_runtime_disable(crc->dev);
 	pm_runtime_put_noidle(crc->dev);
 
-	clk_disable_unprepare(crc->clk);
-
-	return 0;
+	if (ret >= 0)
+		clk_disable(crc->clk);
+	clk_unprepare(crc->clk);
 }
 
 static int __maybe_unused stm32_crc_suspend(struct device *dev)
@@ -472,7 +467,7 @@ MODULE_DEVICE_TABLE(of, stm32_dt_ids);
 
 static struct platform_driver stm32_crc_driver = {
 	.probe  = stm32_crc_probe,
-	.remove = stm32_crc_remove,
+	.remove_new = stm32_crc_remove,
 	.driver = {
 		.name           = DRIVER_NAME,
 		.pm		= &stm32_crc_pm_ops,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 39/42] crypto: stm32/cryp - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
                   ` (13 preceding siblings ...)
  2023-10-20  7:56 ` [PATCH 38/42] crypto: stm32/crc32 " Uwe Kleine-König
@ 2023-10-20  7:56 ` Uwe Kleine-König
  2023-10-20  7:56 ` [PATCH 41/42] crypto: xilinx/zynqmp-aes-gcm " Uwe Kleine-König
  2023-10-20  7:56 ` [PATCH 42/42] crypto: xilinx/zynqmp-sha " Uwe Kleine-König
  16 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:56 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Maxime Coquelin, Alexandre Torgue, Linus Walleij,
	nicolas.toromanoff, Colin Ian King, Rob Herring, linux-crypto,
	linux-stm32, linux-arm-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

The driver adapted here suffered from this wrong assumption and had
several error paths resulting in resource leaks.

The check for cryp being non-NULL is harmless. This can never happen as
.remove() is only called after .probe() completed successfully and in
that case drvdata was set to a non-NULL value. So this check can just be
dropped.

If pm_runtime_get() fails, the other resources held by the device must
still be freed. Only clk_disable_unprepare() should be skipped as the
pm_runtime_get() failed to call clk_prepare_enable().

After these changes the remove function returns zero unconditionally and
can trivially be converted to the prototype required for .remove_new().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/stm32/stm32-cryp.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/crypto/stm32/stm32-cryp.c b/drivers/crypto/stm32/stm32-cryp.c
index f095f0065428..c3cbc2673338 100644
--- a/drivers/crypto/stm32/stm32-cryp.c
+++ b/drivers/crypto/stm32/stm32-cryp.c
@@ -2084,17 +2084,12 @@ static int stm32_cryp_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int stm32_cryp_remove(struct platform_device *pdev)
+static void stm32_cryp_remove(struct platform_device *pdev)
 {
 	struct stm32_cryp *cryp = platform_get_drvdata(pdev);
 	int ret;
 
-	if (!cryp)
-		return -ENODEV;
-
-	ret = pm_runtime_resume_and_get(cryp->dev);
-	if (ret < 0)
-		return ret;
+	ret = pm_runtime_get_sync(cryp->dev);
 
 	if (cryp->caps->aeads_support)
 		crypto_engine_unregister_aeads(aead_algs, ARRAY_SIZE(aead_algs));
@@ -2109,9 +2104,8 @@ static int stm32_cryp_remove(struct platform_device *pdev)
 	pm_runtime_disable(cryp->dev);
 	pm_runtime_put_noidle(cryp->dev);
 
-	clk_disable_unprepare(cryp->clk);
-
-	return 0;
+	if (ret >= 0)
+		clk_disable_unprepare(cryp->clk);
 }
 
 #ifdef CONFIG_PM
@@ -2148,7 +2142,7 @@ static const struct dev_pm_ops stm32_cryp_pm_ops = {
 
 static struct platform_driver stm32_cryp_driver = {
 	.probe  = stm32_cryp_probe,
-	.remove = stm32_cryp_remove,
+	.remove_new = stm32_cryp_remove,
 	.driver = {
 		.name           = DRIVER_NAME,
 		.pm		= &stm32_cryp_pm_ops,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 41/42] crypto: xilinx/zynqmp-aes-gcm - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
                   ` (14 preceding siblings ...)
  2023-10-20  7:56 ` [PATCH 39/42] crypto: stm32/cryp " Uwe Kleine-König
@ 2023-10-20  7:56 ` Uwe Kleine-König
  2023-10-20  9:19   ` Michal Simek
  2023-10-20  7:56 ` [PATCH 42/42] crypto: xilinx/zynqmp-sha " Uwe Kleine-König
  16 siblings, 1 reply; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:56 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Michal Simek, Rob Herring, linux-crypto, linux-arm-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/xilinx/zynqmp-aes-gcm.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/xilinx/zynqmp-aes-gcm.c b/drivers/crypto/xilinx/zynqmp-aes-gcm.c
index ce335578b759..3c205324b22b 100644
--- a/drivers/crypto/xilinx/zynqmp-aes-gcm.c
+++ b/drivers/crypto/xilinx/zynqmp-aes-gcm.c
@@ -421,12 +421,10 @@ static int zynqmp_aes_aead_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int zynqmp_aes_aead_remove(struct platform_device *pdev)
+static void zynqmp_aes_aead_remove(struct platform_device *pdev)
 {
 	crypto_engine_exit(aes_drv_ctx.engine);
 	crypto_engine_unregister_aead(&aes_drv_ctx.alg.aead);
-
-	return 0;
 }
 
 static const struct of_device_id zynqmp_aes_dt_ids[] = {
@@ -437,7 +435,7 @@ MODULE_DEVICE_TABLE(of, zynqmp_aes_dt_ids);
 
 static struct platform_driver zynqmp_aes_driver = {
 	.probe	= zynqmp_aes_aead_probe,
-	.remove = zynqmp_aes_aead_remove,
+	.remove_new = zynqmp_aes_aead_remove,
 	.driver = {
 		.name		= "zynqmp-aes",
 		.of_match_table = zynqmp_aes_dt_ids,
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 42/42] crypto: xilinx/zynqmp-sha - Convert to platform remove callback returning void
       [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
                   ` (15 preceding siblings ...)
  2023-10-20  7:56 ` [PATCH 41/42] crypto: xilinx/zynqmp-aes-gcm " Uwe Kleine-König
@ 2023-10-20  7:56 ` Uwe Kleine-König
  2023-10-20  9:20   ` Michal Simek
  16 siblings, 1 reply; 37+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:56 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Harsha, Michal Simek, linux-crypto, linux-arm-kernel, kernel

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/xilinx/zynqmp-sha.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/xilinx/zynqmp-sha.c b/drivers/crypto/xilinx/zynqmp-sha.c
index 426bf1a72ba6..e6c45ceb4bf7 100644
--- a/drivers/crypto/xilinx/zynqmp-sha.c
+++ b/drivers/crypto/xilinx/zynqmp-sha.c
@@ -238,20 +238,18 @@ static int zynqmp_sha_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int zynqmp_sha_remove(struct platform_device *pdev)
+static void zynqmp_sha_remove(struct platform_device *pdev)
 {
 	sha3_drv_ctx.dev = platform_get_drvdata(pdev);
 
 	dma_free_coherent(sha3_drv_ctx.dev, ZYNQMP_DMA_ALLOC_FIXED_SIZE, ubuf, update_dma_addr);
 	dma_free_coherent(sha3_drv_ctx.dev, SHA3_384_DIGEST_SIZE, fbuf, final_dma_addr);
 	crypto_unregister_shash(&sha3_drv_ctx.sha3_384);
-
-	return 0;
 }
 
 static struct platform_driver zynqmp_sha_driver = {
 	.probe = zynqmp_sha_probe,
-	.remove = zynqmp_sha_remove,
+	.remove_new = zynqmp_sha_remove,
 	.driver = {
 		.name = "zynqmp-sha3-384",
 	},
-- 
2.42.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* Re: [PATCH 34/42] crypto: rockchip/rk3288 - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 34/42] crypto: rockchip/rk3288 " Uwe Kleine-König
@ 2023-10-20  8:13   ` Heiko Stübner
  2023-10-25 13:31   ` Corentin LABBE
  1 sibling, 0 replies; 37+ messages in thread
From: Heiko Stübner @ 2023-10-20  8:13 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Uwe Kleine-König
  Cc: Corentin Labbe, linux-crypto, linux-arm-kernel, linux-rockchip,
	kernel

Am Freitag, 20. Oktober 2023, 09:55:56 CEST schrieb Uwe Kleine-König:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Heiko Stuebner <heiko@sntech.de>



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 16/42] crypto: exynos-rng - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 16/42] crypto: exynos-rng " Uwe Kleine-König
@ 2023-10-20  8:18   ` Krzysztof Kozlowski
  2023-10-24 21:52   ` Andi Shyti
  1 sibling, 0 replies; 37+ messages in thread
From: Krzysztof Kozlowski @ 2023-10-20  8:18 UTC (permalink / raw)
  To: Uwe Kleine-König, Herbert Xu, David S. Miller
  Cc: Alim Akhtar, linux-crypto, linux-samsung-soc, linux-arm-kernel,
	kernel

On 20/10/2023 09:55, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 08/42] crypto: atmel-aes - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 08/42] crypto: atmel-aes " Uwe Kleine-König
@ 2023-10-20  8:49   ` Hari.PrasathGE
  0 siblings, 0 replies; 37+ messages in thread
From: Hari.PrasathGE @ 2023-10-20  8:49 UTC (permalink / raw)
  To: u.kleine-koenig, herbert, davem
  Cc: alexandre.belloni, Ryan.Wanner, claudiu.beznea, linux-crypto,
	kernel, linux-arm-kernel



On 20/10/23 1:25 pm, Uwe Kleine-König wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

This and the two consecutive Atmel/Microchip specific patches looks good 
to me.

Reviewed-by: Hari Prasath Gujulan Elango <hari.prasathge@microchip.com>

> ---
>   drivers/crypto/atmel-aes.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/atmel-aes.c b/drivers/crypto/atmel-aes.c
> index 55b5f577b01c..d1d93e897892 100644
> --- a/drivers/crypto/atmel-aes.c
> +++ b/drivers/crypto/atmel-aes.c
> @@ -2648,7 +2648,7 @@ static int atmel_aes_probe(struct platform_device *pdev)
>          return err;
>   }
> 
> -static int atmel_aes_remove(struct platform_device *pdev)
> +static void atmel_aes_remove(struct platform_device *pdev)
>   {
>          struct atmel_aes_dev *aes_dd;
> 
> @@ -2667,13 +2667,11 @@ static int atmel_aes_remove(struct platform_device *pdev)
>          atmel_aes_buff_cleanup(aes_dd);
> 
>          clk_unprepare(aes_dd->iclk);
> -
> -       return 0;
>   }
> 
>   static struct platform_driver atmel_aes_driver = {
>          .probe          = atmel_aes_probe,
> -       .remove         = atmel_aes_remove,
> +       .remove_new     = atmel_aes_remove,
>          .driver         = {
>                  .name   = "atmel_aes",
>                  .of_match_table = atmel_aes_dt_ids,
> --
> 2.42.0
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 41/42] crypto: xilinx/zynqmp-aes-gcm - Convert to platform remove callback returning void
  2023-10-20  7:56 ` [PATCH 41/42] crypto: xilinx/zynqmp-aes-gcm " Uwe Kleine-König
@ 2023-10-20  9:19   ` Michal Simek
  0 siblings, 0 replies; 37+ messages in thread
From: Michal Simek @ 2023-10-20  9:19 UTC (permalink / raw)
  To: Uwe Kleine-König, Herbert Xu, David S. Miller
  Cc: Rob Herring, linux-crypto, linux-arm-kernel, kernel



On 10/20/23 09:56, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>   drivers/crypto/xilinx/zynqmp-aes-gcm.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/xilinx/zynqmp-aes-gcm.c b/drivers/crypto/xilinx/zynqmp-aes-gcm.c
> index ce335578b759..3c205324b22b 100644
> --- a/drivers/crypto/xilinx/zynqmp-aes-gcm.c
> +++ b/drivers/crypto/xilinx/zynqmp-aes-gcm.c
> @@ -421,12 +421,10 @@ static int zynqmp_aes_aead_probe(struct platform_device *pdev)
>   	return err;
>   }
>   
> -static int zynqmp_aes_aead_remove(struct platform_device *pdev)
> +static void zynqmp_aes_aead_remove(struct platform_device *pdev)
>   {
>   	crypto_engine_exit(aes_drv_ctx.engine);
>   	crypto_engine_unregister_aead(&aes_drv_ctx.alg.aead);
> -
> -	return 0;
>   }
>   
>   static const struct of_device_id zynqmp_aes_dt_ids[] = {
> @@ -437,7 +435,7 @@ MODULE_DEVICE_TABLE(of, zynqmp_aes_dt_ids);
>   
>   static struct platform_driver zynqmp_aes_driver = {
>   	.probe	= zynqmp_aes_aead_probe,
> -	.remove = zynqmp_aes_aead_remove,
> +	.remove_new = zynqmp_aes_aead_remove,
>   	.driver = {
>   		.name		= "zynqmp-aes",
>   		.of_match_table = zynqmp_aes_dt_ids,


Reviewed-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 42/42] crypto: xilinx/zynqmp-sha - Convert to platform remove callback returning void
  2023-10-20  7:56 ` [PATCH 42/42] crypto: xilinx/zynqmp-sha " Uwe Kleine-König
@ 2023-10-20  9:20   ` Michal Simek
  0 siblings, 0 replies; 37+ messages in thread
From: Michal Simek @ 2023-10-20  9:20 UTC (permalink / raw)
  To: Uwe Kleine-König, Herbert Xu, David S. Miller
  Cc: Harsha, linux-crypto, linux-arm-kernel, kernel



On 10/20/23 09:56, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>   drivers/crypto/xilinx/zynqmp-sha.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/xilinx/zynqmp-sha.c b/drivers/crypto/xilinx/zynqmp-sha.c
> index 426bf1a72ba6..e6c45ceb4bf7 100644
> --- a/drivers/crypto/xilinx/zynqmp-sha.c
> +++ b/drivers/crypto/xilinx/zynqmp-sha.c
> @@ -238,20 +238,18 @@ static int zynqmp_sha_probe(struct platform_device *pdev)
>   	return err;
>   }
>   
> -static int zynqmp_sha_remove(struct platform_device *pdev)
> +static void zynqmp_sha_remove(struct platform_device *pdev)
>   {
>   	sha3_drv_ctx.dev = platform_get_drvdata(pdev);
>   
>   	dma_free_coherent(sha3_drv_ctx.dev, ZYNQMP_DMA_ALLOC_FIXED_SIZE, ubuf, update_dma_addr);
>   	dma_free_coherent(sha3_drv_ctx.dev, SHA3_384_DIGEST_SIZE, fbuf, final_dma_addr);
>   	crypto_unregister_shash(&sha3_drv_ctx.sha3_384);
> -
> -	return 0;
>   }
>   
>   static struct platform_driver zynqmp_sha_driver = {
>   	.probe = zynqmp_sha_probe,
> -	.remove = zynqmp_sha_remove,
> +	.remove_new = zynqmp_sha_remove,
>   	.driver = {
>   		.name = "zynqmp-sha3-384",
>   	},


Reviewed-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 01/42] crypto: sun4i-ss - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 01/42] crypto: sun4i-ss - Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-10-20 10:10   ` Andre Przywara
  2023-10-20 14:08   ` Jernej Škrabec
  2023-10-25 13:13   ` Corentin Labbe
  2 siblings, 0 replies; 37+ messages in thread
From: Andre Przywara @ 2023-10-20 10:10 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Herbert Xu, David S. Miller, Corentin Labbe, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Jonathan Corbet, Rob Herring,
	linux-crypto, linux-arm-kernel, linux-sunxi, kernel

On Fri, 20 Oct 2023 09:55:23 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

Hi,

> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
> index 3bcfcfc37084..ba80878e2df5 100644
> --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
> +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
> @@ -509,7 +509,7 @@ static int sun4i_ss_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int sun4i_ss_remove(struct platform_device *pdev)
> +static void sun4i_ss_remove(struct platform_device *pdev)
>  {
>  	int i;
>  	struct sun4i_ss_ctx *ss = platform_get_drvdata(pdev);
> @@ -529,7 +529,6 @@ static int sun4i_ss_remove(struct platform_device *pdev)
>  	}
>  
>  	sun4i_ss_pm_exit(ss);
> -	return 0;
>  }
>  
>  static const struct of_device_id a20ss_crypto_of_match_table[] = {
> @@ -545,7 +544,7 @@ MODULE_DEVICE_TABLE(of, a20ss_crypto_of_match_table);
>  
>  static struct platform_driver sun4i_ss_driver = {
>  	.probe          = sun4i_ss_probe,
> -	.remove         = sun4i_ss_remove,
> +	.remove_new     = sun4i_ss_remove,
>  	.driver         = {
>  		.name           = "sun4i-ss",
>  		.pm		= &sun4i_ss_pm_ops,


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 02/42] crypto: sun8i-ce - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 02/42] crypto: sun8i-ce " Uwe Kleine-König
@ 2023-10-20 10:12   ` Andre Przywara
  2023-10-20 14:08   ` Jernej Škrabec
  2023-10-25 13:14   ` Corentin Labbe
  2 siblings, 0 replies; 37+ messages in thread
From: Andre Przywara @ 2023-10-20 10:12 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Herbert Xu, David S. Miller, Corentin Labbe, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Rob Herring, Jonathan Corbet,
	linux-crypto, linux-arm-kernel, linux-sunxi, kernel

On Fri, 20 Oct 2023 09:55:24 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

Hi,

> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
> index d4ccd5254280..1741758e03eb 100644
> --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
> +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
> @@ -1071,7 +1071,7 @@ static int sun8i_ce_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int sun8i_ce_remove(struct platform_device *pdev)
> +static void sun8i_ce_remove(struct platform_device *pdev)
>  {
>  	struct sun8i_ce_dev *ce = platform_get_drvdata(pdev);
>  
> @@ -1088,7 +1088,6 @@ static int sun8i_ce_remove(struct platform_device *pdev)
>  	sun8i_ce_free_chanlist(ce, MAXFLOW - 1);
>  
>  	sun8i_ce_pm_exit(ce);
> -	return 0;
>  }
>  
>  static const struct of_device_id sun8i_ce_crypto_of_match_table[] = {
> @@ -1110,7 +1109,7 @@ MODULE_DEVICE_TABLE(of, sun8i_ce_crypto_of_match_table);
>  
>  static struct platform_driver sun8i_ce_driver = {
>  	.probe		 = sun8i_ce_probe,
> -	.remove		 = sun8i_ce_remove,
> +	.remove_new	 = sun8i_ce_remove,
>  	.driver		 = {
>  		.name		= "sun8i-ce",
>  		.pm		= &sun8i_ce_pm_ops,


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 03/42] crypto: sun8i-ss - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 03/42] crypto: sun8i-ss " Uwe Kleine-König
@ 2023-10-20 10:12   ` Andre Przywara
  2023-10-20 14:09   ` Jernej Škrabec
  2023-10-25 13:14   ` Corentin Labbe
  2 siblings, 0 replies; 37+ messages in thread
From: Andre Przywara @ 2023-10-20 10:12 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Herbert Xu, David S. Miller, Corentin Labbe, Chen-Yu Tsai,
	Jernej Skrabec, Samuel Holland, Jonathan Corbet, Rob Herring,
	linux-crypto, linux-arm-kernel, linux-sunxi, kernel

On Fri, 20 Oct 2023 09:55:25 +0200
Uwe Kleine-König <u.kleine-koenig@pengutronix.de> wrote:

Hi,

> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre

> ---
>  drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
> index 4a9587285c04..f14c60359d19 100644
> --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
> +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
> @@ -908,7 +908,7 @@ static int sun8i_ss_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int sun8i_ss_remove(struct platform_device *pdev)
> +static void sun8i_ss_remove(struct platform_device *pdev)
>  {
>  	struct sun8i_ss_dev *ss = platform_get_drvdata(pdev);
>  
> @@ -921,8 +921,6 @@ static int sun8i_ss_remove(struct platform_device *pdev)
>  	sun8i_ss_free_flows(ss, MAXFLOW - 1);
>  
>  	sun8i_ss_pm_exit(ss);
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id sun8i_ss_crypto_of_match_table[] = {
> @@ -936,7 +934,7 @@ MODULE_DEVICE_TABLE(of, sun8i_ss_crypto_of_match_table);
>  
>  static struct platform_driver sun8i_ss_driver = {
>  	.probe		 = sun8i_ss_probe,
> -	.remove		 = sun8i_ss_remove,
> +	.remove_new	 = sun8i_ss_remove,
>  	.driver		 = {
>  		.name		= "sun8i-ss",
>  		.pm             = &sun8i_ss_pm_ops,


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 01/42] crypto: sun4i-ss - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 01/42] crypto: sun4i-ss - Convert to platform remove callback returning void Uwe Kleine-König
  2023-10-20 10:10   ` Andre Przywara
@ 2023-10-20 14:08   ` Jernej Škrabec
  2023-10-25 13:13   ` Corentin Labbe
  2 siblings, 0 replies; 37+ messages in thread
From: Jernej Škrabec @ 2023-10-20 14:08 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Uwe Kleine-König
  Cc: Corentin Labbe, Chen-Yu Tsai, Samuel Holland, Jonathan Corbet,
	Rob Herring, linux-crypto, linux-arm-kernel, linux-sunxi, kernel

Dne petek, 20. oktober 2023 ob 09:55:23 CEST je Uwe Kleine-König napisal(a):
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej

>  drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
> index 3bcfcfc37084..ba80878e2df5 100644
> --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
> +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
> @@ -509,7 +509,7 @@ static int sun4i_ss_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int sun4i_ss_remove(struct platform_device *pdev)
> +static void sun4i_ss_remove(struct platform_device *pdev)
>  {
>  	int i;
>  	struct sun4i_ss_ctx *ss = platform_get_drvdata(pdev);
> @@ -529,7 +529,6 @@ static int sun4i_ss_remove(struct platform_device *pdev)
>  	}
>  
>  	sun4i_ss_pm_exit(ss);
> -	return 0;
>  }
>  
>  static const struct of_device_id a20ss_crypto_of_match_table[] = {
> @@ -545,7 +544,7 @@ MODULE_DEVICE_TABLE(of, a20ss_crypto_of_match_table);
>  
>  static struct platform_driver sun4i_ss_driver = {
>  	.probe          = sun4i_ss_probe,
> -	.remove         = sun4i_ss_remove,
> +	.remove_new     = sun4i_ss_remove,
>  	.driver         = {
>  		.name           = "sun4i-ss",
>  		.pm		= &sun4i_ss_pm_ops,
> 





_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 02/42] crypto: sun8i-ce - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 02/42] crypto: sun8i-ce " Uwe Kleine-König
  2023-10-20 10:12   ` Andre Przywara
@ 2023-10-20 14:08   ` Jernej Škrabec
  2023-10-25 13:14   ` Corentin Labbe
  2 siblings, 0 replies; 37+ messages in thread
From: Jernej Škrabec @ 2023-10-20 14:08 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Uwe Kleine-König
  Cc: Corentin Labbe, Chen-Yu Tsai, Samuel Holland, Rob Herring,
	Jonathan Corbet, linux-crypto, linux-arm-kernel, linux-sunxi,
	kernel

Dne petek, 20. oktober 2023 ob 09:55:24 CEST je Uwe Kleine-König napisal(a):
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej

>  drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
> index d4ccd5254280..1741758e03eb 100644
> --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
> +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
> @@ -1071,7 +1071,7 @@ static int sun8i_ce_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int sun8i_ce_remove(struct platform_device *pdev)
> +static void sun8i_ce_remove(struct platform_device *pdev)
>  {
>  	struct sun8i_ce_dev *ce = platform_get_drvdata(pdev);
>  
> @@ -1088,7 +1088,6 @@ static int sun8i_ce_remove(struct platform_device *pdev)
>  	sun8i_ce_free_chanlist(ce, MAXFLOW - 1);
>  
>  	sun8i_ce_pm_exit(ce);
> -	return 0;
>  }
>  
>  static const struct of_device_id sun8i_ce_crypto_of_match_table[] = {
> @@ -1110,7 +1109,7 @@ MODULE_DEVICE_TABLE(of, sun8i_ce_crypto_of_match_table);
>  
>  static struct platform_driver sun8i_ce_driver = {
>  	.probe		 = sun8i_ce_probe,
> -	.remove		 = sun8i_ce_remove,
> +	.remove_new	 = sun8i_ce_remove,
>  	.driver		 = {
>  		.name		= "sun8i-ce",
>  		.pm		= &sun8i_ce_pm_ops,
> 





_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 03/42] crypto: sun8i-ss - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 03/42] crypto: sun8i-ss " Uwe Kleine-König
  2023-10-20 10:12   ` Andre Przywara
@ 2023-10-20 14:09   ` Jernej Škrabec
  2023-10-25 13:14   ` Corentin Labbe
  2 siblings, 0 replies; 37+ messages in thread
From: Jernej Škrabec @ 2023-10-20 14:09 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Uwe Kleine-König
  Cc: Corentin Labbe, Chen-Yu Tsai, Samuel Holland, Jonathan Corbet,
	Rob Herring, linux-crypto, linux-arm-kernel, linux-sunxi, kernel

Dne petek, 20. oktober 2023 ob 09:55:25 CEST je Uwe Kleine-König napisal(a):
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---

Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej

>  drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
> index 4a9587285c04..f14c60359d19 100644
> --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
> +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
> @@ -908,7 +908,7 @@ static int sun8i_ss_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int sun8i_ss_remove(struct platform_device *pdev)
> +static void sun8i_ss_remove(struct platform_device *pdev)
>  {
>  	struct sun8i_ss_dev *ss = platform_get_drvdata(pdev);
>  
> @@ -921,8 +921,6 @@ static int sun8i_ss_remove(struct platform_device *pdev)
>  	sun8i_ss_free_flows(ss, MAXFLOW - 1);
>  
>  	sun8i_ss_pm_exit(ss);
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id sun8i_ss_crypto_of_match_table[] = {
> @@ -936,7 +934,7 @@ MODULE_DEVICE_TABLE(of, sun8i_ss_crypto_of_match_table);
>  
>  static struct platform_driver sun8i_ss_driver = {
>  	.probe		 = sun8i_ss_probe,
> -	.remove		 = sun8i_ss_remove,
> +	.remove_new	 = sun8i_ss_remove,
>  	.driver		 = {
>  		.name		= "sun8i-ss",
>  		.pm             = &sun8i_ss_pm_ops,
> 





_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 06/42] crypto: aspeed-acry - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 06/42] crypto: aspeed-acry " Uwe Kleine-König
@ 2023-10-23  2:35   ` Andrew Jeffery
  0 siblings, 0 replies; 37+ messages in thread
From: Andrew Jeffery @ 2023-10-23  2:35 UTC (permalink / raw)
  To: Uwe Kleine-König, Herbert Xu, David S. Miller
  Cc: Neal Liu, Joel Stanley, linux-aspeed, linux-crypto,
	linux-arm-kernel, kernel

On Fri, 2023-10-20 at 09:55 +0200, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 07/42] crypto: aspeed-hace - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 07/42] crypto: aspeed-hace " Uwe Kleine-König
@ 2023-10-23  2:36   ` Andrew Jeffery
  0 siblings, 0 replies; 37+ messages in thread
From: Andrew Jeffery @ 2023-10-23  2:36 UTC (permalink / raw)
  To: Uwe Kleine-König, Herbert Xu, David S. Miller
  Cc: Neal Liu, Joel Stanley, linux-aspeed, linux-crypto,
	linux-arm-kernel, kernel

On Fri, 2023-10-20 at 09:55 +0200, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 16/42] crypto: exynos-rng - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 16/42] crypto: exynos-rng " Uwe Kleine-König
  2023-10-20  8:18   ` Krzysztof Kozlowski
@ 2023-10-24 21:52   ` Andi Shyti
  1 sibling, 0 replies; 37+ messages in thread
From: Andi Shyti @ 2023-10-24 21:52 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Herbert Xu, David S. Miller, Krzysztof Kozlowski, Alim Akhtar,
	linux-crypto, linux-samsung-soc, linux-arm-kernel, kernel

Hi Uwe,

On Fri, Oct 20, 2023 at 09:55:38AM +0200, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Reviewed-by: Andi Shyti <andi.shyti@kernel.org>

Andi

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 01/42] crypto: sun4i-ss - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 01/42] crypto: sun4i-ss - Convert to platform remove callback returning void Uwe Kleine-König
  2023-10-20 10:10   ` Andre Przywara
  2023-10-20 14:08   ` Jernej Škrabec
@ 2023-10-25 13:13   ` Corentin Labbe
  2 siblings, 0 replies; 37+ messages in thread
From: Corentin Labbe @ 2023-10-25 13:13 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Herbert Xu, David S. Miller, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Jonathan Corbet, Rob Herring, linux-crypto,
	linux-arm-kernel, linux-sunxi, kernel

Le Fri, Oct 20, 2023 at 09:55:23AM +0200, Uwe Kleine-König a écrit :
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
> index 3bcfcfc37084..ba80878e2df5 100644
> --- a/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
> +++ b/drivers/crypto/allwinner/sun4i-ss/sun4i-ss-core.c
> @@ -509,7 +509,7 @@ static int sun4i_ss_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int sun4i_ss_remove(struct platform_device *pdev)
> +static void sun4i_ss_remove(struct platform_device *pdev)
>  {
>  	int i;
>  	struct sun4i_ss_ctx *ss = platform_get_drvdata(pdev);
> @@ -529,7 +529,6 @@ static int sun4i_ss_remove(struct platform_device *pdev)
>  	}
>  
>  	sun4i_ss_pm_exit(ss);
> -	return 0;
>  }
>  
>  static const struct of_device_id a20ss_crypto_of_match_table[] = {
> @@ -545,7 +544,7 @@ MODULE_DEVICE_TABLE(of, a20ss_crypto_of_match_table);
>  
>  static struct platform_driver sun4i_ss_driver = {
>  	.probe          = sun4i_ss_probe,
> -	.remove         = sun4i_ss_remove,
> +	.remove_new     = sun4i_ss_remove,
>  	.driver         = {
>  		.name           = "sun4i-ss",
>  		.pm		= &sun4i_ss_pm_ops,
> -- 
> 2.42.0
> 

Acked-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Thanks

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 02/42] crypto: sun8i-ce - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 02/42] crypto: sun8i-ce " Uwe Kleine-König
  2023-10-20 10:12   ` Andre Przywara
  2023-10-20 14:08   ` Jernej Škrabec
@ 2023-10-25 13:14   ` Corentin Labbe
  2 siblings, 0 replies; 37+ messages in thread
From: Corentin Labbe @ 2023-10-25 13:14 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Herbert Xu, David S. Miller, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Rob Herring, Jonathan Corbet, linux-crypto,
	linux-arm-kernel, linux-sunxi, kernel

Le Fri, Oct 20, 2023 at 09:55:24AM +0200, Uwe Kleine-König a écrit :
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
> index d4ccd5254280..1741758e03eb 100644
> --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
> +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c
> @@ -1071,7 +1071,7 @@ static int sun8i_ce_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int sun8i_ce_remove(struct platform_device *pdev)
> +static void sun8i_ce_remove(struct platform_device *pdev)
>  {
>  	struct sun8i_ce_dev *ce = platform_get_drvdata(pdev);
>  
> @@ -1088,7 +1088,6 @@ static int sun8i_ce_remove(struct platform_device *pdev)
>  	sun8i_ce_free_chanlist(ce, MAXFLOW - 1);
>  
>  	sun8i_ce_pm_exit(ce);
> -	return 0;
>  }
>  
>  static const struct of_device_id sun8i_ce_crypto_of_match_table[] = {
> @@ -1110,7 +1109,7 @@ MODULE_DEVICE_TABLE(of, sun8i_ce_crypto_of_match_table);
>  
>  static struct platform_driver sun8i_ce_driver = {
>  	.probe		 = sun8i_ce_probe,
> -	.remove		 = sun8i_ce_remove,
> +	.remove_new	 = sun8i_ce_remove,
>  	.driver		 = {
>  		.name		= "sun8i-ce",
>  		.pm		= &sun8i_ce_pm_ops,
> -- 
> 2.42.0
> 
Acked-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Thanks

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 03/42] crypto: sun8i-ss - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 03/42] crypto: sun8i-ss " Uwe Kleine-König
  2023-10-20 10:12   ` Andre Przywara
  2023-10-20 14:09   ` Jernej Škrabec
@ 2023-10-25 13:14   ` Corentin Labbe
  2 siblings, 0 replies; 37+ messages in thread
From: Corentin Labbe @ 2023-10-25 13:14 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Herbert Xu, David S. Miller, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland, Jonathan Corbet, Rob Herring, linux-crypto,
	linux-arm-kernel, linux-sunxi, kernel

Le Fri, Oct 20, 2023 at 09:55:25AM +0200, Uwe Kleine-König a écrit :
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
> index 4a9587285c04..f14c60359d19 100644
> --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
> +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c
> @@ -908,7 +908,7 @@ static int sun8i_ss_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int sun8i_ss_remove(struct platform_device *pdev)
> +static void sun8i_ss_remove(struct platform_device *pdev)
>  {
>  	struct sun8i_ss_dev *ss = platform_get_drvdata(pdev);
>  
> @@ -921,8 +921,6 @@ static int sun8i_ss_remove(struct platform_device *pdev)
>  	sun8i_ss_free_flows(ss, MAXFLOW - 1);
>  
>  	sun8i_ss_pm_exit(ss);
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id sun8i_ss_crypto_of_match_table[] = {
> @@ -936,7 +934,7 @@ MODULE_DEVICE_TABLE(of, sun8i_ss_crypto_of_match_table);
>  
>  static struct platform_driver sun8i_ss_driver = {
>  	.probe		 = sun8i_ss_probe,
> -	.remove		 = sun8i_ss_remove,
> +	.remove_new	 = sun8i_ss_remove,
>  	.driver		 = {
>  		.name		= "sun8i-ss",
>  		.pm             = &sun8i_ss_pm_ops,
> -- 
> 2.42.0
> 
Acked-by: Corentin Labbe <clabbe.montjoie@gmail.com>

Thanks

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 17/42] crypto: gemini/sl3516-ce - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 17/42] crypto: gemini/sl3516-ce " Uwe Kleine-König
@ 2023-10-25 13:30   ` Corentin LABBE
  0 siblings, 0 replies; 37+ messages in thread
From: Corentin LABBE @ 2023-10-25 13:30 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Herbert Xu, David S. Miller, Hans Ulli Kroll, Linus Walleij,
	linux-arm-kernel, linux-crypto, kernel

Le Fri, Oct 20, 2023 at 09:55:39AM +0200, Uwe Kleine-König a écrit :
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/crypto/gemini/sl3516-ce-core.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/gemini/sl3516-ce-core.c b/drivers/crypto/gemini/sl3516-ce-core.c
> index 0f43c6e39bb9..1d1a889599bb 100644
> --- a/drivers/crypto/gemini/sl3516-ce-core.c
> +++ b/drivers/crypto/gemini/sl3516-ce-core.c
> @@ -505,7 +505,7 @@ static int sl3516_ce_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int sl3516_ce_remove(struct platform_device *pdev)
> +static void sl3516_ce_remove(struct platform_device *pdev)
>  {
>  	struct sl3516_ce_dev *ce = platform_get_drvdata(pdev);
>  
> @@ -518,8 +518,6 @@ static int sl3516_ce_remove(struct platform_device *pdev)
>  #ifdef CONFIG_CRYPTO_DEV_SL3516_DEBUG
>  	debugfs_remove_recursive(ce->dbgfs_dir);
>  #endif
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id sl3516_ce_crypto_of_match_table[] = {
> @@ -530,7 +528,7 @@ MODULE_DEVICE_TABLE(of, sl3516_ce_crypto_of_match_table);
>  
>  static struct platform_driver sl3516_ce_driver = {
>  	.probe		 = sl3516_ce_probe,
> -	.remove		 = sl3516_ce_remove,
> +	.remove_new	 = sl3516_ce_remove,
>  	.driver		 = {
>  		.name		= "sl3516-crypto",
>  		.pm		= &sl3516_ce_pm_ops,
> -- 
> 2.42.0
> 

Acked-by: Corentin Labbe <clabbe@baylibre.com>

Thanks

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 22/42] crypto: intel/ixp4xx-crypto - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 22/42] crypto: intel/ixp4xx-crypto " Uwe Kleine-König
@ 2023-10-25 13:30   ` Corentin LABBE
  0 siblings, 0 replies; 37+ messages in thread
From: Corentin LABBE @ 2023-10-25 13:30 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Herbert Xu, David S. Miller, Linus Walleij, Imre Kaloz,
	linux-arm-kernel, linux-crypto, kernel

Le Fri, Oct 20, 2023 at 09:55:44AM +0200, Uwe Kleine-König a écrit :
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c b/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c
> index 4a18095ae5d8..f8a77bff8844 100644
> --- a/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c
> +++ b/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c
> @@ -1563,7 +1563,7 @@ static int ixp_crypto_probe(struct platform_device *_pdev)
>  	return 0;
>  }
>  
> -static int ixp_crypto_remove(struct platform_device *pdev)
> +static void ixp_crypto_remove(struct platform_device *pdev)
>  {
>  	int num = ARRAY_SIZE(ixp4xx_algos);
>  	int i;
> @@ -1578,8 +1578,6 @@ static int ixp_crypto_remove(struct platform_device *pdev)
>  			crypto_unregister_skcipher(&ixp4xx_algos[i].crypto);
>  	}
>  	release_ixp_crypto(&pdev->dev);
> -
> -	return 0;
>  }
>  static const struct of_device_id ixp4xx_crypto_of_match[] = {
>  	{
> @@ -1590,7 +1588,7 @@ static const struct of_device_id ixp4xx_crypto_of_match[] = {
>  
>  static struct platform_driver ixp_crypto_driver = {
>  	.probe = ixp_crypto_probe,
> -	.remove = ixp_crypto_remove,
> +	.remove_new = ixp_crypto_remove,
>  	.driver = {
>  		.name = "ixp4xx_crypto",
>  		.of_match_table = ixp4xx_crypto_of_match,
> -- 
> 2.42.0
> 

Acked-by: Corentin Labbe <clabbe@baylibre.com>

Thanks

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 34/42] crypto: rockchip/rk3288 - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 34/42] crypto: rockchip/rk3288 " Uwe Kleine-König
  2023-10-20  8:13   ` Heiko Stübner
@ 2023-10-25 13:31   ` Corentin LABBE
  1 sibling, 0 replies; 37+ messages in thread
From: Corentin LABBE @ 2023-10-25 13:31 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Herbert Xu, David S. Miller, Heiko Stuebner, linux-crypto,
	linux-arm-kernel, linux-rockchip, kernel

Le Fri, Oct 20, 2023 at 09:55:56AM +0200, Uwe Kleine-König a écrit :
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/crypto/rockchip/rk3288_crypto.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/rockchip/rk3288_crypto.c b/drivers/crypto/rockchip/rk3288_crypto.c
> index 77d5705a5d96..70edf40bc523 100644
> --- a/drivers/crypto/rockchip/rk3288_crypto.c
> +++ b/drivers/crypto/rockchip/rk3288_crypto.c
> @@ -405,7 +405,7 @@ static int rk_crypto_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int rk_crypto_remove(struct platform_device *pdev)
> +static void rk_crypto_remove(struct platform_device *pdev)
>  {
>  	struct rk_crypto_info *crypto_tmp = platform_get_drvdata(pdev);
>  	struct rk_crypto_info *first;
> @@ -424,12 +424,11 @@ static int rk_crypto_remove(struct platform_device *pdev)
>  	}
>  	rk_crypto_pm_exit(crypto_tmp);
>  	crypto_engine_exit(crypto_tmp->engine);
> -	return 0;
>  }
>  
>  static struct platform_driver crypto_driver = {
>  	.probe		= rk_crypto_probe,
> -	.remove		= rk_crypto_remove,
> +	.remove_new	= rk_crypto_remove,
>  	.driver		= {
>  		.name	= "rk3288-crypto",
>  		.pm		= &rk_crypto_pm_ops,
> -- 
> 2.42.0
> 

Acked-by: Corentin Labbe <clabbe@baylibre.com>

Thanks

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2023-10-25 13:32 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20231020075521.2121571-44-u.kleine-koenig@pengutronix.de>
2023-10-20  7:55 ` [PATCH 01/42] crypto: sun4i-ss - Convert to platform remove callback returning void Uwe Kleine-König
2023-10-20 10:10   ` Andre Przywara
2023-10-20 14:08   ` Jernej Škrabec
2023-10-25 13:13   ` Corentin Labbe
2023-10-20  7:55 ` [PATCH 02/42] crypto: sun8i-ce " Uwe Kleine-König
2023-10-20 10:12   ` Andre Przywara
2023-10-20 14:08   ` Jernej Škrabec
2023-10-25 13:14   ` Corentin Labbe
2023-10-20  7:55 ` [PATCH 03/42] crypto: sun8i-ss " Uwe Kleine-König
2023-10-20 10:12   ` Andre Przywara
2023-10-20 14:09   ` Jernej Škrabec
2023-10-25 13:14   ` Corentin Labbe
2023-10-20  7:55 ` [PATCH 06/42] crypto: aspeed-acry " Uwe Kleine-König
2023-10-23  2:35   ` Andrew Jeffery
2023-10-20  7:55 ` [PATCH 07/42] crypto: aspeed-hace " Uwe Kleine-König
2023-10-23  2:36   ` Andrew Jeffery
2023-10-20  7:55 ` [PATCH 08/42] crypto: atmel-aes " Uwe Kleine-König
2023-10-20  8:49   ` Hari.PrasathGE
2023-10-20  7:55 ` [PATCH 09/42] crypto: atmel-sha " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 10/42] crypto: atmel-tdes " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 16/42] crypto: exynos-rng " Uwe Kleine-König
2023-10-20  8:18   ` Krzysztof Kozlowski
2023-10-24 21:52   ` Andi Shyti
2023-10-20  7:55 ` [PATCH 17/42] crypto: gemini/sl3516-ce " Uwe Kleine-König
2023-10-25 13:30   ` Corentin LABBE
2023-10-20  7:55 ` [PATCH 22/42] crypto: intel/ixp4xx-crypto " Uwe Kleine-König
2023-10-25 13:30   ` Corentin LABBE
2023-10-20  7:55 ` [PATCH 27/42] crypto: mxs-dcp " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 34/42] crypto: rockchip/rk3288 " Uwe Kleine-König
2023-10-20  8:13   ` Heiko Stübner
2023-10-25 13:31   ` Corentin LABBE
2023-10-20  7:56 ` [PATCH 38/42] crypto: stm32/crc32 " Uwe Kleine-König
2023-10-20  7:56 ` [PATCH 39/42] crypto: stm32/cryp " Uwe Kleine-König
2023-10-20  7:56 ` [PATCH 41/42] crypto: xilinx/zynqmp-aes-gcm " Uwe Kleine-König
2023-10-20  9:19   ` Michal Simek
2023-10-20  7:56 ` [PATCH 42/42] crypto: xilinx/zynqmp-sha " Uwe Kleine-König
2023-10-20  9:20   ` Michal Simek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).