linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/42] crypto: Convert to platform remove callback returning void
@ 2023-10-20  7:55 Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 01/42] crypto: sun4i-ss - " Uwe Kleine-König
                   ` (41 more replies)
  0 siblings, 42 replies; 69+ 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, Yu Zhe, Corentin Labbe, linux-amlogic,
	Neal Liu, Joel Stanley, Andrew Jeffery, linux-aspeed,
	Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, Jesper Nilsson,
	Lars Persson, linux-arm-kernel, Arnd Bergmann, Horia Geantă,
	Pankaj Gupta, Gaurav Jain, Tom Lendacky, John Allen,
	Gilad Ben-Yossef, Krzysztof Kozlowski, Alim Akhtar,
	linux-samsung-soc, Hans Ulli Kroll, Linus Walleij, Ruan Jinjie,
	Weili Qian, Antoine Tenart, Linus Walleij, Imre Kaloz,
	Daniele Alessandrelli, Prabhjot Khurana, Mark Gross,
	Declan Murphy, Boris Brezillon, Arnaud Ebalard, Srujana Challa,
	Shawn Guo, Sascha Hauer, Fabio Estevam, NXP Linux Team,
	Thara Gopinath, linux-arm-msm, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Heiko Stuebner, linux-rockchip,
	Vladimir Zapolskiy, Maxime Coquelin, Alexandre Torgue,
	linux-stm32, nicolas.toromanoff, Colin Ian King, Michal Simek,
	Harsha

Hello,

this series converts all platform drivers below drivers/crypto to use
.remove_new(). Compared to the traditional .remove() callback
.remove_new() returns no value. This is a good thing because the driver
core doesn't (and cannot) cope for errors during remove. The only effect
of a non-zero return value in .remove() is that the driver core emits a
warning. The device is removed anyhow and an early return from .remove()
usually yields resource leaks and/or use-after-free bugs.

There are three drivers that got that wrong and potentially returned an
error code (caam/jr.c, stm32/stm32-crc32.c, stm32/stm32-cryp.c). These
are fixed accordingly. The other drivers could be transformed trivially.

See commit 5c5a7680e67b ("platform: Provide a remove callback that
returns no value") for an extended explanation and the eventual goal.

There are no interdependencies in this series. As there are still quite
a few drivers to convert, I'm happy about every patch that makes it in.
So even if there is a merge conflict with one patch until you apply (or
a different concern that doesn't apply to all patches), please apply the
remainder of this series anyhow. I'll come back to the part that you
(maybe) skipped at a later point.

Best regards and thanks
Uwe

Uwe Kleine-König (42):
  crypto: sun4i-ss - Convert to platform remove callback returning void
  crypto: sun8i-ce - Convert to platform remove callback returning void
  crypto: sun8i-ss - Convert to platform remove callback returning void
  crypto: amcc/crypto4xx - Convert to platform remove callback returning void
  crypto: amlogic-gxl-core - Convert to platform remove callback returning void
  crypto: aspeed-acry - Convert to platform remove callback returning void
  crypto: aspeed-hace - Convert to platform remove callback returning void
  crypto: atmel-aes - Convert to platform remove callback returning void
  crypto: atmel-sha - Convert to platform remove callback returning void
  crypto: atmel-tdes - Convert to platform remove callback returning void
  crypto: axis/artpec6 - Convert to platform remove callback returning void
  crypto: bcm/cipher - Convert to platform remove callback returning void
  crypto: caam/jr - Convert to platform remove callback returning void
  crypto: ccp/sp - Convert to platform remove callback returning void
  crypto: ccree/cc - Convert to platform remove callback returning void
  crypto: exynos-rng - Convert to platform remove callback returning void
  crypto: gemini/sl3516-ce - Convert to platform remove callback returning void
  crypto: hisilicon/sec - Convert to platform remove callback returning void
  crypto: hisilicon/trng - Convert to platform remove callback returning void
  crypto: img-hash - Convert to platform remove callback returning void
  crypto: inside-secure/safexcel - Convert to platform remove callback returning void
  crypto: intel/ixp4xx-crypto - Convert to platform remove callback returning void
  crypto: intel/keembay-ocs-aes - Convert to platform remove callback returning void
  crypto: intel/keembay-ocs-ecc - Convert to platform remove callback returning void
  crypto: intel/keembay-ocs-hcu - Convert to platform remove callback returning void
  crypto: marvell/cesa - Convert to platform remove callback returning void
  crypto: mxs-dcp - Convert to platform remove callback returning void
  crypto: n2_core - Convert to platform remove callback returning void
  crypto: omap-aes - Convert to platform remove callback returning void
  crypto: omap-des - Convert to platform remove callback returning void
  crypto: omap-sham - Convert to platform remove callback returning void
  crypto: qce - Convert to platform remove callback returning void
  crypto: qcom-rng - Convert to platform remove callback returning void
  crypto: rockchip/rk3288 - Convert to platform remove callback returning void
  crypto: s5p-sss - Convert to platform remove callback returning void
  crypto: sa2ul - Convert to platform remove callback returning void
  crypto: sahara - Convert to platform remove callback returning void
  crypto: stm32/crc32 - Convert to platform remove callback returning void
  crypto: stm32/cryp - Convert to platform remove callback returning void
  crypto: talitos - Convert to platform remove callback returning void
  crypto: xilinx/zynqmp-aes-gcm - Convert to platform remove callback returning void
  crypto: xilinx/zynqmp-sha - Convert to platform remove callback returning void

 .../crypto/allwinner/sun4i-ss/sun4i-ss-core.c |  5 ++---
 .../crypto/allwinner/sun8i-ce/sun8i-ce-core.c |  5 ++---
 .../crypto/allwinner/sun8i-ss/sun8i-ss-core.c |  6 ++---
 drivers/crypto/amcc/crypto4xx_core.c          |  6 ++---
 drivers/crypto/amlogic/amlogic-gxl-core.c     |  5 ++---
 drivers/crypto/aspeed/aspeed-acry.c           |  6 ++---
 drivers/crypto/aspeed/aspeed-hace.c           |  6 ++---
 drivers/crypto/atmel-aes.c                    |  6 ++---
 drivers/crypto/atmel-sha.c                    |  6 ++---
 drivers/crypto/atmel-tdes.c                   |  6 ++---
 drivers/crypto/axis/artpec6_crypto.c          |  5 ++---
 drivers/crypto/bcm/cipher.c                   |  5 ++---
 drivers/crypto/caam/jr.c                      | 22 ++++++++-----------
 drivers/crypto/ccp/sp-platform.c              |  6 ++---
 drivers/crypto/ccree/cc_driver.c              |  6 ++---
 drivers/crypto/exynos-rng.c                   |  6 ++---
 drivers/crypto/gemini/sl3516-ce-core.c        |  6 ++---
 drivers/crypto/hisilicon/sec/sec_drv.c        |  6 ++---
 drivers/crypto/hisilicon/trng/trng.c          |  6 ++---
 drivers/crypto/img-hash.c                     |  6 ++---
 drivers/crypto/inside-secure/safexcel.c       |  6 ++---
 drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c   |  6 ++---
 .../intel/keembay/keembay-ocs-aes-core.c      |  6 ++---
 .../crypto/intel/keembay/keembay-ocs-ecc.c    |  6 ++---
 .../intel/keembay/keembay-ocs-hcu-core.c      |  6 ++---
 drivers/crypto/marvell/cesa/cesa.c            |  6 ++---
 drivers/crypto/mxs-dcp.c                      |  6 ++---
 drivers/crypto/n2_core.c                      | 12 ++++------
 drivers/crypto/omap-aes.c                     |  6 ++---
 drivers/crypto/omap-des.c                     |  6 ++---
 drivers/crypto/omap-sham.c                    |  6 ++---
 drivers/crypto/qce/core.c                     |  5 ++---
 drivers/crypto/qcom-rng.c                     |  6 ++---
 drivers/crypto/rockchip/rk3288_crypto.c       |  5 ++---
 drivers/crypto/s5p-sss.c                      |  6 ++---
 drivers/crypto/sa2ul.c                        |  6 ++---
 drivers/crypto/sahara.c                       |  6 ++---
 drivers/crypto/stm32/stm32-crc32.c            | 15 +++++--------
 drivers/crypto/stm32/stm32-cryp.c             | 16 +++++---------
 drivers/crypto/talitos.c                      |  6 ++---
 drivers/crypto/xilinx/zynqmp-aes-gcm.c        |  6 ++---
 drivers/crypto/xilinx/zynqmp-sha.c            |  6 ++---
 42 files changed, 99 insertions(+), 187 deletions(-)

base-commit: 4230ea146b1e64628f11e44290bb4008e391bc24
-- 
2.42.0


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

* [PATCH 01/42] crypto: sun4i-ss - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
@ 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
                   ` (40 subsequent siblings)
  41 siblings, 3 replies; 69+ 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


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

* [PATCH 02/42] crypto: sun8i-ce - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 01/42] crypto: sun4i-ss - " 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
                   ` (39 subsequent siblings)
  41 siblings, 3 replies; 69+ 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


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

* [PATCH 03/42] crypto: sun8i-ss - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 01/42] crypto: sun4i-ss - " 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 04/42] crypto: amcc/crypto4xx " Uwe Kleine-König
                   ` (38 subsequent siblings)
  41 siblings, 3 replies; 69+ 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


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

* [PATCH 04/42] crypto: amcc/crypto4xx - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (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-20  7:55 ` [PATCH 05/42] crypto: amlogic-gxl-core " Uwe Kleine-König
                   ` (37 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: Yu Zhe, 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/amcc/crypto4xx_core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index d553f3f1efbe..8d53372245ad 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -1507,7 +1507,7 @@ static int crypto4xx_probe(struct platform_device *ofdev)
 	return rc;
 }
 
-static int crypto4xx_remove(struct platform_device *ofdev)
+static void crypto4xx_remove(struct platform_device *ofdev)
 {
 	struct device *dev = &ofdev->dev;
 	struct crypto4xx_core_device *core_dev = dev_get_drvdata(dev);
@@ -1523,8 +1523,6 @@ static int crypto4xx_remove(struct platform_device *ofdev)
 	mutex_destroy(&core_dev->rng_lock);
 	/* Free all allocated memory */
 	crypto4xx_stop_all(core_dev);
-
-	return 0;
 }
 
 static const struct of_device_id crypto4xx_match[] = {
@@ -1539,7 +1537,7 @@ static struct platform_driver crypto4xx_driver = {
 		.of_match_table = crypto4xx_match,
 	},
 	.probe		= crypto4xx_probe,
-	.remove		= crypto4xx_remove,
+	.remove_new	= crypto4xx_remove,
 };
 
 module_platform_driver(crypto4xx_driver);
-- 
2.42.0


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

* [PATCH 05/42] crypto: amlogic-gxl-core - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (3 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 04/42] crypto: amcc/crypto4xx " 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 06/42] crypto: aspeed-acry " Uwe Kleine-König
                   ` (36 subsequent siblings)
  41 siblings, 1 reply; 69+ 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, linux-crypto, linux-amlogic, 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/amlogic/amlogic-gxl-core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/amlogic/amlogic-gxl-core.c b/drivers/crypto/amlogic/amlogic-gxl-core.c
index da6dfe0f9ac3..f54ab0d0b1e8 100644
--- a/drivers/crypto/amlogic/amlogic-gxl-core.c
+++ b/drivers/crypto/amlogic/amlogic-gxl-core.c
@@ -299,7 +299,7 @@ static int meson_crypto_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int meson_crypto_remove(struct platform_device *pdev)
+static void meson_crypto_remove(struct platform_device *pdev)
 {
 	struct meson_dev *mc = platform_get_drvdata(pdev);
 
@@ -312,7 +312,6 @@ static int meson_crypto_remove(struct platform_device *pdev)
 	meson_free_chanlist(mc, MAXFLOW - 1);
 
 	clk_disable_unprepare(mc->busclk);
-	return 0;
 }
 
 static const struct of_device_id meson_crypto_of_match_table[] = {
@@ -323,7 +322,7 @@ MODULE_DEVICE_TABLE(of, meson_crypto_of_match_table);
 
 static struct platform_driver meson_crypto_driver = {
 	.probe		 = meson_crypto_probe,
-	.remove		 = meson_crypto_remove,
+	.remove_new	 = meson_crypto_remove,
 	.driver		 = {
 		.name		   = "gxl-crypto",
 		.of_match_table	= meson_crypto_of_match_table,
-- 
2.42.0


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

* [PATCH 06/42] crypto: aspeed-acry - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (4 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 05/42] crypto: amlogic-gxl-core " 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
                   ` (35 subsequent siblings)
  41 siblings, 1 reply; 69+ 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


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

* [PATCH 07/42] crypto: aspeed-hace - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (5 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
                   ` (34 subsequent siblings)
  41 siblings, 1 reply; 69+ 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


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

* [PATCH 08/42] crypto: atmel-aes - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (6 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
                   ` (33 subsequent siblings)
  41 siblings, 1 reply; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, 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/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


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

* [PATCH 09/42] crypto: atmel-sha - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (7 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
                   ` (32 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, 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/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


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

* [PATCH 10/42] crypto: atmel-tdes - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (8 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 11/42] crypto: axis/artpec6 " Uwe Kleine-König
                   ` (31 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, 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/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


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

* [PATCH 11/42] crypto: axis/artpec6 - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (9 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-23  7:36   ` Jesper Nilsson
  2023-10-20  7:55 ` [PATCH 12/42] crypto: bcm/cipher " Uwe Kleine-König
                   ` (30 subsequent siblings)
  41 siblings, 1 reply; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Jesper Nilsson, Lars Persson, 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/axis/artpec6_crypto.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c
index 8493a45e1bd4..07996b6c3446 100644
--- a/drivers/crypto/axis/artpec6_crypto.c
+++ b/drivers/crypto/axis/artpec6_crypto.c
@@ -2957,7 +2957,7 @@ static int artpec6_crypto_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int artpec6_crypto_remove(struct platform_device *pdev)
+static void artpec6_crypto_remove(struct platform_device *pdev)
 {
 	struct artpec6_crypto *ac = platform_get_drvdata(pdev);
 	int irq = platform_get_irq(pdev, 0);
@@ -2977,12 +2977,11 @@ static int artpec6_crypto_remove(struct platform_device *pdev)
 #ifdef CONFIG_DEBUG_FS
 	artpec6_crypto_free_debugfs();
 #endif
-	return 0;
 }
 
 static struct platform_driver artpec6_crypto_driver = {
 	.probe   = artpec6_crypto_probe,
-	.remove  = artpec6_crypto_remove,
+	.remove_new = artpec6_crypto_remove,
 	.driver  = {
 		.name  = "artpec6-crypto",
 		.of_match_table = artpec6_crypto_of_match,
-- 
2.42.0


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

* [PATCH 12/42] crypto: bcm/cipher - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (10 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 11/42] crypto: axis/artpec6 " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 13/42] crypto: caam/jr " Uwe Kleine-König
                   ` (29 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Arnd Bergmann, Rob Herring, 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/bcm/cipher.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
index 689be70d69c1..10968ddb146b 100644
--- a/drivers/crypto/bcm/cipher.c
+++ b/drivers/crypto/bcm/cipher.c
@@ -4713,7 +4713,7 @@ static int bcm_spu_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int bcm_spu_remove(struct platform_device *pdev)
+static void bcm_spu_remove(struct platform_device *pdev)
 {
 	int i;
 	struct device *dev = &pdev->dev;
@@ -4751,7 +4751,6 @@ static int bcm_spu_remove(struct platform_device *pdev)
 	}
 	spu_free_debugfs();
 	spu_mb_release(pdev);
-	return 0;
 }
 
 /* ===== Kernel Module API ===== */
@@ -4762,7 +4761,7 @@ static struct platform_driver bcm_spu_pdriver = {
 		   .of_match_table = of_match_ptr(bcm_spu_dt_ids),
 		   },
 	.probe = bcm_spu_probe,
-	.remove = bcm_spu_remove,
+	.remove_new = bcm_spu_remove,
 };
 module_platform_driver(bcm_spu_pdriver);
 
-- 
2.42.0


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

* [PATCH 13/42] crypto: caam/jr - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (11 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 12/42] crypto: bcm/cipher " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 14/42] crypto: ccp/sp " Uwe Kleine-König
                   ` (28 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Horia Geantă, Pankaj Gupta, Gaurav Jain, 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 (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 suffers from this wrong assumption. Returning
-EBUSY if there are still users results in resource leaks and probably a
crash. Also further down passing the error code of caam_jr_shutdown() to
the caller only results in another error message and has no further
consequences compared to returning zero.

Still convert the driver to return no value in the remove callback. This
also allows to drop caam_jr_platform_shutdown() as the only function
called by it now has the same prototype.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/crypto/caam/jr.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c
index b1f1b393b98e..26eba7de3fb0 100644
--- a/drivers/crypto/caam/jr.c
+++ b/drivers/crypto/caam/jr.c
@@ -180,7 +180,7 @@ static int caam_jr_shutdown(struct device *dev)
 	return ret;
 }
 
-static int caam_jr_remove(struct platform_device *pdev)
+static void caam_jr_remove(struct platform_device *pdev)
 {
 	int ret;
 	struct device *jrdev;
@@ -193,11 +193,14 @@ static int caam_jr_remove(struct platform_device *pdev)
 		caam_rng_exit(jrdev->parent);
 
 	/*
-	 * Return EBUSY if job ring already allocated.
+	 * If a job ring is still allocated there is trouble ahead. Once
+	 * caam_jr_remove() returned, jrpriv will be freed and the registers
+	 * will get unmapped. So any user of such a job ring will probably
+	 * crash.
 	 */
 	if (atomic_read(&jrpriv->tfm_count)) {
-		dev_err(jrdev, "Device is busy\n");
-		return -EBUSY;
+		dev_alert(jrdev, "Device is busy; consumers might start to crash\n");
+		return;
 	}
 
 	/* Unregister JR-based RNG & crypto algorithms */
@@ -212,13 +215,6 @@ static int caam_jr_remove(struct platform_device *pdev)
 	ret = caam_jr_shutdown(jrdev);
 	if (ret)
 		dev_err(jrdev, "Failed to shut down job ring\n");
-
-	return ret;
-}
-
-static void caam_jr_platform_shutdown(struct platform_device *pdev)
-{
-	caam_jr_remove(pdev);
 }
 
 /* Main per-ring interrupt handler */
@@ -823,8 +819,8 @@ static struct platform_driver caam_jr_driver = {
 		.pm = pm_ptr(&caam_jr_pm_ops),
 	},
 	.probe       = caam_jr_probe,
-	.remove      = caam_jr_remove,
-	.shutdown    = caam_jr_platform_shutdown,
+	.remove_new  = caam_jr_remove,
+	.shutdown    = caam_jr_remove,
 };
 
 static int __init jr_driver_init(void)
-- 
2.42.0


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

* [PATCH 14/42] crypto: ccp/sp - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (12 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 13/42] crypto: caam/jr " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20 18:00   ` Tom Lendacky
  2023-10-20  7:55 ` [PATCH 15/42] crypto: ccree/cc " Uwe Kleine-König
                   ` (27 subsequent siblings)
  41 siblings, 1 reply; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Tom Lendacky, John Allen, 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/ccp/sp-platform.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c
index 7d79a8744f9a..473301237760 100644
--- a/drivers/crypto/ccp/sp-platform.c
+++ b/drivers/crypto/ccp/sp-platform.c
@@ -180,7 +180,7 @@ static int sp_platform_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int sp_platform_remove(struct platform_device *pdev)
+static void sp_platform_remove(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct sp_device *sp = dev_get_drvdata(dev);
@@ -188,8 +188,6 @@ static int sp_platform_remove(struct platform_device *pdev)
 	sp_destroy(sp);
 
 	dev_notice(dev, "disabled\n");
-
-	return 0;
 }
 
 #ifdef CONFIG_PM
@@ -222,7 +220,7 @@ static struct platform_driver sp_platform_driver = {
 #endif
 	},
 	.probe = sp_platform_probe,
-	.remove = sp_platform_remove,
+	.remove_new = sp_platform_remove,
 #ifdef CONFIG_PM
 	.suspend = sp_platform_suspend,
 	.resume = sp_platform_resume,
-- 
2.42.0


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

* [PATCH 15/42] crypto: ccree/cc - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (13 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 14/42] crypto: ccp/sp " 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
                   ` (26 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: Gilad Ben-Yossef, 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/ccree/cc_driver.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/ccree/cc_driver.c b/drivers/crypto/ccree/cc_driver.c
index 0f0694037dd7..9177b54bb0f5 100644
--- a/drivers/crypto/ccree/cc_driver.c
+++ b/drivers/crypto/ccree/cc_driver.c
@@ -623,7 +623,7 @@ static int ccree_probe(struct platform_device *plat_dev)
 	return 0;
 }
 
-static int ccree_remove(struct platform_device *plat_dev)
+static void ccree_remove(struct platform_device *plat_dev)
 {
 	struct device *dev = &plat_dev->dev;
 
@@ -632,8 +632,6 @@ static int ccree_remove(struct platform_device *plat_dev)
 	cleanup_cc_resources(plat_dev);
 
 	dev_info(dev, "ARM ccree device terminated\n");
-
-	return 0;
 }
 
 static struct platform_driver ccree_driver = {
@@ -645,7 +643,7 @@ static struct platform_driver ccree_driver = {
 #endif
 	},
 	.probe = ccree_probe,
-	.remove = ccree_remove,
+	.remove_new = ccree_remove,
 };
 
 static int __init ccree_init(void)
-- 
2.42.0


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

* [PATCH 16/42] crypto: exynos-rng - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (14 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 15/42] crypto: ccree/cc " 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
                   ` (25 subsequent siblings)
  41 siblings, 2 replies; 69+ 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


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

* [PATCH 17/42] crypto: gemini/sl3516-ce - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (15 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 18/42] crypto: hisilicon/sec " Uwe Kleine-König
                   ` (24 subsequent siblings)
  41 siblings, 1 reply; 69+ 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


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

* [PATCH 18/42] crypto: hisilicon/sec - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (16 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-20  7:55 ` [PATCH 19/42] crypto: hisilicon/trng " Uwe Kleine-König
                   ` (23 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: Ruan Jinjie, 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/hisilicon/sec/sec_drv.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/hisilicon/sec/sec_drv.c b/drivers/crypto/hisilicon/sec/sec_drv.c
index e1e08993de12..afdddf87cc34 100644
--- a/drivers/crypto/hisilicon/sec/sec_drv.c
+++ b/drivers/crypto/hisilicon/sec/sec_drv.c
@@ -1271,7 +1271,7 @@ static int sec_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int sec_remove(struct platform_device *pdev)
+static void sec_remove(struct platform_device *pdev)
 {
 	struct sec_dev_info *info = platform_get_drvdata(pdev);
 	int i;
@@ -1287,8 +1287,6 @@ static int sec_remove(struct platform_device *pdev)
 	}
 
 	sec_base_exit(info);
-
-	return 0;
 }
 
 static const __maybe_unused struct of_device_id sec_match[] = {
@@ -1306,7 +1304,7 @@ MODULE_DEVICE_TABLE(acpi, sec_acpi_match);
 
 static struct platform_driver sec_driver = {
 	.probe = sec_probe,
-	.remove = sec_remove,
+	.remove_new = sec_remove,
 	.driver = {
 		.name = "hisi_sec_platform_driver",
 		.of_match_table = sec_match,
-- 
2.42.0


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

* [PATCH 19/42] crypto: hisilicon/trng - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (17 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 18/42] crypto: hisilicon/sec " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  9:39   ` Weili Qian
  2023-10-20  7:55 ` [PATCH 20/42] crypto: img-hash " Uwe Kleine-König
                   ` (22 subsequent siblings)
  41 siblings, 1 reply; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: Weili Qian, 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/hisilicon/trng/trng.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/hisilicon/trng/trng.c b/drivers/crypto/hisilicon/trng/trng.c
index 97e500db0a82..451b167bcc73 100644
--- a/drivers/crypto/hisilicon/trng/trng.c
+++ b/drivers/crypto/hisilicon/trng/trng.c
@@ -303,7 +303,7 @@ static int hisi_trng_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int hisi_trng_remove(struct platform_device *pdev)
+static void hisi_trng_remove(struct platform_device *pdev)
 {
 	struct hisi_trng *trng = platform_get_drvdata(pdev);
 
@@ -314,8 +314,6 @@ static int hisi_trng_remove(struct platform_device *pdev)
 	if (trng->ver != HISI_TRNG_VER_V1 &&
 	    atomic_dec_return(&trng_active_devs) == 0)
 		crypto_unregister_rng(&hisi_trng_alg);
-
-	return 0;
 }
 
 static const struct acpi_device_id hisi_trng_acpi_match[] = {
@@ -326,7 +324,7 @@ MODULE_DEVICE_TABLE(acpi, hisi_trng_acpi_match);
 
 static struct platform_driver hisi_trng_driver = {
 	.probe		= hisi_trng_probe,
-	.remove         = hisi_trng_remove,
+	.remove_new     = hisi_trng_remove,
 	.driver		= {
 		.name	= "hisi-trng-v2",
 		.acpi_match_table = ACPI_PTR(hisi_trng_acpi_match),
-- 
2.42.0


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

* [PATCH 20/42] crypto: img-hash - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (18 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 19/42] crypto: hisilicon/trng " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 21/42] crypto: inside-secure/safexcel " Uwe Kleine-König
                   ` (21 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: 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/img-hash.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/img-hash.c b/drivers/crypto/img-hash.c
index 45063693859c..d269036bdaa3 100644
--- a/drivers/crypto/img-hash.c
+++ b/drivers/crypto/img-hash.c
@@ -1043,7 +1043,7 @@ static int img_hash_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int img_hash_remove(struct platform_device *pdev)
+static void img_hash_remove(struct platform_device *pdev)
 {
 	struct img_hash_dev *hdev;
 
@@ -1061,8 +1061,6 @@ static int img_hash_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(hdev->hash_clk);
 	clk_disable_unprepare(hdev->sys_clk);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -1101,7 +1099,7 @@ static const struct dev_pm_ops img_hash_pm_ops = {
 
 static struct platform_driver img_hash_driver = {
 	.probe		= img_hash_probe,
-	.remove		= img_hash_remove,
+	.remove_new	= img_hash_remove,
 	.driver		= {
 		.name	= "img-hash-accelerator",
 		.pm	= &img_hash_pm_ops,
-- 
2.42.0


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

* [PATCH 21/42] crypto: inside-secure/safexcel - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (19 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 20/42] crypto: img-hash " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 22/42] crypto: intel/ixp4xx-crypto " Uwe Kleine-König
                   ` (20 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: Antoine Tenart, 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/inside-secure/safexcel.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c
index 9ff02b5abc4a..76da14af74b5 100644
--- a/drivers/crypto/inside-secure/safexcel.c
+++ b/drivers/crypto/inside-secure/safexcel.c
@@ -1801,7 +1801,7 @@ static int safexcel_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int safexcel_remove(struct platform_device *pdev)
+static void safexcel_remove(struct platform_device *pdev)
 {
 	struct safexcel_crypto_priv *priv = platform_get_drvdata(pdev);
 	int i;
@@ -1816,8 +1816,6 @@ static int safexcel_remove(struct platform_device *pdev)
 		irq_set_affinity_hint(priv->ring[i].irq, NULL);
 		destroy_workqueue(priv->ring[i].workqueue);
 	}
-
-	return 0;
 }
 
 static const struct safexcel_priv_data eip97ies_mrvl_data = {
@@ -1874,7 +1872,7 @@ MODULE_DEVICE_TABLE(of, safexcel_of_match_table);
 
 static struct platform_driver  crypto_safexcel = {
 	.probe		= safexcel_probe,
-	.remove		= safexcel_remove,
+	.remove_new	= safexcel_remove,
 	.driver		= {
 		.name	= "crypto-safexcel",
 		.of_match_table = safexcel_of_match_table,
-- 
2.42.0


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

* [PATCH 22/42] crypto: intel/ixp4xx-crypto - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (20 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 21/42] crypto: inside-secure/safexcel " 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 23/42] crypto: intel/keembay-ocs-aes " Uwe Kleine-König
                   ` (19 subsequent siblings)
  41 siblings, 1 reply; 69+ 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


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

* [PATCH 23/42] crypto: intel/keembay-ocs-aes - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (21 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 24/42] crypto: intel/keembay-ocs-ecc " Uwe Kleine-König
                   ` (18 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: Daniele Alessandrelli, 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/keembay/keembay-ocs-aes-core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/intel/keembay/keembay-ocs-aes-core.c b/drivers/crypto/intel/keembay/keembay-ocs-aes-core.c
index 1e2fd9a754ec..9b2d098e5eb2 100644
--- a/drivers/crypto/intel/keembay/keembay-ocs-aes-core.c
+++ b/drivers/crypto/intel/keembay/keembay-ocs-aes-core.c
@@ -1562,7 +1562,7 @@ static const struct of_device_id kmb_ocs_aes_of_match[] = {
 	{}
 };
 
-static int kmb_ocs_aes_remove(struct platform_device *pdev)
+static void kmb_ocs_aes_remove(struct platform_device *pdev)
 {
 	struct ocs_aes_dev *aes_dev;
 
@@ -1575,8 +1575,6 @@ static int kmb_ocs_aes_remove(struct platform_device *pdev)
 	spin_unlock(&ocs_aes.lock);
 
 	crypto_engine_exit(aes_dev->engine);
-
-	return 0;
 }
 
 static int kmb_ocs_aes_probe(struct platform_device *pdev)
@@ -1658,7 +1656,7 @@ static int kmb_ocs_aes_probe(struct platform_device *pdev)
 /* The OCS driver is a platform device. */
 static struct platform_driver kmb_ocs_aes_driver = {
 	.probe = kmb_ocs_aes_probe,
-	.remove = kmb_ocs_aes_remove,
+	.remove_new = kmb_ocs_aes_remove,
 	.driver = {
 			.name = DRV_NAME,
 			.of_match_table = kmb_ocs_aes_of_match,
-- 
2.42.0


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

* [PATCH 24/42] crypto: intel/keembay-ocs-ecc - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (22 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 23/42] crypto: intel/keembay-ocs-aes " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 25/42] crypto: intel/keembay-ocs-hcu " Uwe Kleine-König
                   ` (17 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Daniele Alessandrelli, Prabhjot Khurana, Mark Gross,
	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/keembay/keembay-ocs-ecc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/intel/keembay/keembay-ocs-ecc.c b/drivers/crypto/intel/keembay/keembay-ocs-ecc.c
index fb95deed9057..5e24f2d8affc 100644
--- a/drivers/crypto/intel/keembay/keembay-ocs-ecc.c
+++ b/drivers/crypto/intel/keembay/keembay-ocs-ecc.c
@@ -964,7 +964,7 @@ static int kmb_ocs_ecc_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static int kmb_ocs_ecc_remove(struct platform_device *pdev)
+static void kmb_ocs_ecc_remove(struct platform_device *pdev)
 {
 	struct ocs_ecc_dev *ecc_dev;
 
@@ -978,8 +978,6 @@ static int kmb_ocs_ecc_remove(struct platform_device *pdev)
 	spin_unlock(&ocs_ecc.lock);
 
 	crypto_engine_exit(ecc_dev->engine);
-
-	return 0;
 }
 
 /* Device tree driver match. */
@@ -993,7 +991,7 @@ static const struct of_device_id kmb_ocs_ecc_of_match[] = {
 /* The OCS driver is a platform device. */
 static struct platform_driver kmb_ocs_ecc_driver = {
 	.probe = kmb_ocs_ecc_probe,
-	.remove = kmb_ocs_ecc_remove,
+	.remove_new = kmb_ocs_ecc_remove,
 	.driver = {
 			.name = DRV_NAME,
 			.of_match_table = kmb_ocs_ecc_of_match,
-- 
2.42.0


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

* [PATCH 25/42] crypto: intel/keembay-ocs-hcu - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (23 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 24/42] crypto: intel/keembay-ocs-ecc " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 26/42] crypto: marvell/cesa " Uwe Kleine-König
                   ` (16 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Daniele Alessandrelli, Declan Murphy, 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/keembay/keembay-ocs-hcu-core.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c b/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c
index 8a39f959bb53..c2dfca73fe4e 100644
--- a/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c
+++ b/drivers/crypto/intel/keembay/keembay-ocs-hcu-core.c
@@ -1151,7 +1151,7 @@ static const struct of_device_id kmb_ocs_hcu_of_match[] = {
 	{}
 };
 
-static int kmb_ocs_hcu_remove(struct platform_device *pdev)
+static void kmb_ocs_hcu_remove(struct platform_device *pdev)
 {
 	struct ocs_hcu_dev *hcu_dev = platform_get_drvdata(pdev);
 
@@ -1162,8 +1162,6 @@ static int kmb_ocs_hcu_remove(struct platform_device *pdev)
 	spin_lock_bh(&ocs_hcu.lock);
 	list_del(&hcu_dev->list);
 	spin_unlock_bh(&ocs_hcu.lock);
-
-	return 0;
 }
 
 static int kmb_ocs_hcu_probe(struct platform_device *pdev)
@@ -1244,7 +1242,7 @@ static int kmb_ocs_hcu_probe(struct platform_device *pdev)
 /* The OCS driver is a platform device. */
 static struct platform_driver kmb_ocs_hcu_driver = {
 	.probe = kmb_ocs_hcu_probe,
-	.remove = kmb_ocs_hcu_remove,
+	.remove_new = kmb_ocs_hcu_remove,
 	.driver = {
 			.name = DRV_NAME,
 			.of_match_table = kmb_ocs_hcu_of_match,
-- 
2.42.0


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

* [PATCH 26/42] crypto: marvell/cesa - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (24 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 25/42] crypto: intel/keembay-ocs-hcu " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 27/42] crypto: mxs-dcp " Uwe Kleine-König
                   ` (15 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Boris Brezillon, Arnaud Ebalard, Srujana Challa, 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/marvell/cesa/cesa.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/marvell/cesa/cesa.c b/drivers/crypto/marvell/cesa/cesa.c
index b61e35b932e5..5744df30c838 100644
--- a/drivers/crypto/marvell/cesa/cesa.c
+++ b/drivers/crypto/marvell/cesa/cesa.c
@@ -581,7 +581,7 @@ static int mv_cesa_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int mv_cesa_remove(struct platform_device *pdev)
+static void mv_cesa_remove(struct platform_device *pdev)
 {
 	struct mv_cesa_dev *cesa = platform_get_drvdata(pdev);
 	int i;
@@ -594,8 +594,6 @@ static int mv_cesa_remove(struct platform_device *pdev)
 		mv_cesa_put_sram(pdev, i);
 		irq_set_affinity_hint(cesa->engines[i].irq, NULL);
 	}
-
-	return 0;
 }
 
 static const struct platform_device_id mv_cesa_plat_id_table[] = {
@@ -606,7 +604,7 @@ MODULE_DEVICE_TABLE(platform, mv_cesa_plat_id_table);
 
 static struct platform_driver marvell_cesa = {
 	.probe		= mv_cesa_probe,
-	.remove		= mv_cesa_remove,
+	.remove_new	= mv_cesa_remove,
 	.id_table	= mv_cesa_plat_id_table,
 	.driver		= {
 		.name	= "marvell-cesa",
-- 
2.42.0


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

* [PATCH 27/42] crypto: mxs-dcp - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (25 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 26/42] crypto: marvell/cesa " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 28/42] crypto: n2_core " Uwe Kleine-König
                   ` (14 subsequent siblings)
  41 siblings, 0 replies; 69+ 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


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

* [PATCH 28/42] crypto: n2_core - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (26 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  7:55 ` [PATCH 29/42] crypto: omap-aes " Uwe Kleine-König
                   ` (13 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: 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/n2_core.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c
index d5a32d71a3e9..caea98622c33 100644
--- a/drivers/crypto/n2_core.c
+++ b/drivers/crypto/n2_core.c
@@ -2011,7 +2011,7 @@ static int n2_crypto_probe(struct platform_device *dev)
 	return err;
 }
 
-static int n2_crypto_remove(struct platform_device *dev)
+static void n2_crypto_remove(struct platform_device *dev)
 {
 	struct n2_crypto *np = dev_get_drvdata(&dev->dev);
 
@@ -2022,8 +2022,6 @@ static int n2_crypto_remove(struct platform_device *dev)
 	release_global_resources();
 
 	free_n2cp(np);
-
-	return 0;
 }
 
 static struct n2_mau *alloc_ncp(void)
@@ -2109,7 +2107,7 @@ static int n2_mau_probe(struct platform_device *dev)
 	return err;
 }
 
-static int n2_mau_remove(struct platform_device *dev)
+static void n2_mau_remove(struct platform_device *dev)
 {
 	struct n2_mau *mp = dev_get_drvdata(&dev->dev);
 
@@ -2118,8 +2116,6 @@ static int n2_mau_remove(struct platform_device *dev)
 	release_global_resources();
 
 	free_ncp(mp);
-
-	return 0;
 }
 
 static const struct of_device_id n2_crypto_match[] = {
@@ -2146,7 +2142,7 @@ static struct platform_driver n2_crypto_driver = {
 		.of_match_table	=	n2_crypto_match,
 	},
 	.probe		=	n2_crypto_probe,
-	.remove		=	n2_crypto_remove,
+	.remove_new	=	n2_crypto_remove,
 };
 
 static const struct of_device_id n2_mau_match[] = {
@@ -2173,7 +2169,7 @@ static struct platform_driver n2_mau_driver = {
 		.of_match_table	=	n2_mau_match,
 	},
 	.probe		=	n2_mau_probe,
-	.remove		=	n2_mau_remove,
+	.remove_new	=	n2_mau_remove,
 };
 
 static struct platform_driver * const drivers[] = {
-- 
2.42.0


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

* [PATCH 29/42] crypto: omap-aes - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (27 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 28/42] crypto: n2_core " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 30/42] crypto: omap-des " Uwe Kleine-König
                   ` (12 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: 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/omap-aes.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
index ed83023dd77a..bad1adacbc84 100644
--- a/drivers/crypto/omap-aes.c
+++ b/drivers/crypto/omap-aes.c
@@ -1255,7 +1255,7 @@ static int omap_aes_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int omap_aes_remove(struct platform_device *pdev)
+static void omap_aes_remove(struct platform_device *pdev)
 {
 	struct omap_aes_dev *dd = platform_get_drvdata(pdev);
 	struct aead_engine_alg *aalg;
@@ -1285,8 +1285,6 @@ static int omap_aes_remove(struct platform_device *pdev)
 	pm_runtime_disable(dd->dev);
 
 	sysfs_remove_group(&dd->dev->kobj, &omap_aes_attr_group);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -1307,7 +1305,7 @@ static SIMPLE_DEV_PM_OPS(omap_aes_pm_ops, omap_aes_suspend, omap_aes_resume);
 
 static struct platform_driver omap_aes_driver = {
 	.probe	= omap_aes_probe,
-	.remove	= omap_aes_remove,
+	.remove_new = omap_aes_remove,
 	.driver	= {
 		.name	= "omap-aes",
 		.pm	= &omap_aes_pm_ops,
-- 
2.42.0


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

* [PATCH 30/42] crypto: omap-des - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (28 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 29/42] crypto: omap-aes " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 31/42] crypto: omap-sham " Uwe Kleine-König
                   ` (11 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: 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/omap-des.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/omap-des.c b/drivers/crypto/omap-des.c
index 089dd45eaedd..209d3dc03a9b 100644
--- a/drivers/crypto/omap-des.c
+++ b/drivers/crypto/omap-des.c
@@ -1072,7 +1072,7 @@ static int omap_des_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int omap_des_remove(struct platform_device *pdev)
+static void omap_des_remove(struct platform_device *pdev)
 {
 	struct omap_des_dev *dd = platform_get_drvdata(pdev);
 	int i, j;
@@ -1089,8 +1089,6 @@ static int omap_des_remove(struct platform_device *pdev)
 	tasklet_kill(&dd->done_task);
 	omap_des_dma_cleanup(dd);
 	pm_runtime_disable(dd->dev);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -1117,7 +1115,7 @@ static SIMPLE_DEV_PM_OPS(omap_des_pm_ops, omap_des_suspend, omap_des_resume);
 
 static struct platform_driver omap_des_driver = {
 	.probe	= omap_des_probe,
-	.remove	= omap_des_remove,
+	.remove_new = omap_des_remove,
 	.driver	= {
 		.name	= "omap-des",
 		.pm	= &omap_des_pm_ops,
-- 
2.42.0


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

* [PATCH 31/42] crypto: omap-sham - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (29 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 30/42] crypto: omap-des " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 32/42] crypto: qce " Uwe Kleine-König
                   ` (10 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: 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/omap-sham.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index a6b4a0b3ace3..496602f7caa5 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -2200,7 +2200,7 @@ static int omap_sham_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int omap_sham_remove(struct platform_device *pdev)
+static void omap_sham_remove(struct platform_device *pdev)
 {
 	struct omap_sham_dev *dd;
 	int i, j;
@@ -2224,13 +2224,11 @@ static int omap_sham_remove(struct platform_device *pdev)
 		dma_release_channel(dd->dma_lch);
 
 	sysfs_remove_group(&dd->dev->kobj, &omap_sham_attr_group);
-
-	return 0;
 }
 
 static struct platform_driver omap_sham_driver = {
 	.probe	= omap_sham_probe,
-	.remove	= omap_sham_remove,
+	.remove_new = omap_sham_remove,
 	.driver	= {
 		.name	= "omap-sham",
 		.of_match_table	= omap_sham_of_match,
-- 
2.42.0


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

* [PATCH 32/42] crypto: qce - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (30 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 31/42] crypto: omap-sham " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 33/42] crypto: qcom-rng " Uwe Kleine-König
                   ` (9 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Thara Gopinath, linux-crypto, linux-arm-msm, 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/qce/core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/qce/core.c b/drivers/crypto/qce/core.c
index fce49c0dee3e..28b5fd823827 100644
--- a/drivers/crypto/qce/core.c
+++ b/drivers/crypto/qce/core.c
@@ -277,7 +277,7 @@ static int qce_crypto_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int qce_crypto_remove(struct platform_device *pdev)
+static void qce_crypto_remove(struct platform_device *pdev)
 {
 	struct qce_device *qce = platform_get_drvdata(pdev);
 
@@ -287,7 +287,6 @@ static int qce_crypto_remove(struct platform_device *pdev)
 	clk_disable_unprepare(qce->bus);
 	clk_disable_unprepare(qce->iface);
 	clk_disable_unprepare(qce->core);
-	return 0;
 }
 
 static const struct of_device_id qce_crypto_of_match[] = {
@@ -300,7 +299,7 @@ MODULE_DEVICE_TABLE(of, qce_crypto_of_match);
 
 static struct platform_driver qce_crypto_driver = {
 	.probe = qce_crypto_probe,
-	.remove = qce_crypto_remove,
+	.remove_new = qce_crypto_remove,
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.of_match_table = qce_crypto_of_match,
-- 
2.42.0


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

* [PATCH 33/42] crypto: qcom-rng - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (31 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 32/42] crypto: qce " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-21 17:23   ` Konrad Dybcio
  2023-10-20  7:55 ` [PATCH 34/42] crypto: rockchip/rk3288 " Uwe Kleine-König
                   ` (8 subsequent siblings)
  41 siblings, 1 reply; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, linux-arm-msm,
	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/qcom-rng.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/qcom-rng.c b/drivers/crypto/qcom-rng.c
index f46b92bb14b5..c670d7d0c11e 100644
--- a/drivers/crypto/qcom-rng.c
+++ b/drivers/crypto/qcom-rng.c
@@ -224,13 +224,11 @@ static int qcom_rng_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int qcom_rng_remove(struct platform_device *pdev)
+static void qcom_rng_remove(struct platform_device *pdev)
 {
 	crypto_unregister_rng(&qcom_rng_alg);
 
 	qcom_rng_dev = NULL;
-
-	return 0;
 }
 
 static struct qcom_rng_of_data qcom_prng_of_data = {
@@ -264,7 +262,7 @@ MODULE_DEVICE_TABLE(of, qcom_rng_of_match);
 
 static struct platform_driver qcom_rng_driver = {
 	.probe = qcom_rng_probe,
-	.remove =  qcom_rng_remove,
+	.remove_new =  qcom_rng_remove,
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.of_match_table = of_match_ptr(qcom_rng_of_match),
-- 
2.42.0


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

* [PATCH 34/42] crypto: rockchip/rk3288 - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (32 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 33/42] crypto: qcom-rng " 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:55 ` [PATCH 35/42] crypto: s5p-sss " Uwe Kleine-König
                   ` (7 subsequent siblings)
  41 siblings, 2 replies; 69+ 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


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

* [PATCH 35/42] crypto: s5p-sss - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (33 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 34/42] crypto: rockchip/rk3288 " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  8:18   ` Krzysztof Kozlowski
  2023-10-20  7:55 ` [PATCH 36/42] crypto: sa2ul " Uwe Kleine-König
                   ` (6 subsequent siblings)
  41 siblings, 1 reply; 69+ 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, Vladimir Zapolskiy, linux-crypto,
	linux-samsung-soc, 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/s5p-sss.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c
index fe8cf9ba8005..9c02046971e3 100644
--- a/drivers/crypto/s5p-sss.c
+++ b/drivers/crypto/s5p-sss.c
@@ -2315,7 +2315,7 @@ static int s5p_aes_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int s5p_aes_remove(struct platform_device *pdev)
+static void s5p_aes_remove(struct platform_device *pdev)
 {
 	struct s5p_aes_dev *pdata = platform_get_drvdata(pdev);
 	int i;
@@ -2337,13 +2337,11 @@ static int s5p_aes_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(pdata->clk);
 	s5p_dev = NULL;
-
-	return 0;
 }
 
 static struct platform_driver s5p_aes_crypto = {
 	.probe	= s5p_aes_probe,
-	.remove	= s5p_aes_remove,
+	.remove_new = s5p_aes_remove,
 	.driver	= {
 		.name	= "s5p-secss",
 		.of_match_table = s5p_sss_dt_match,
-- 
2.42.0


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

* [PATCH 36/42] crypto: sa2ul - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (34 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 35/42] crypto: s5p-sss " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:55 ` [PATCH 37/42] crypto: sahara " Uwe Kleine-König
                   ` (5 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: 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/sa2ul.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/sa2ul.c b/drivers/crypto/sa2ul.c
index 6238d34f8db2..6846a8429574 100644
--- a/drivers/crypto/sa2ul.c
+++ b/drivers/crypto/sa2ul.c
@@ -2468,7 +2468,7 @@ static int sa_ul_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int sa_ul_remove(struct platform_device *pdev)
+static void sa_ul_remove(struct platform_device *pdev)
 {
 	struct sa_crypto_data *dev_data = platform_get_drvdata(pdev);
 
@@ -2486,13 +2486,11 @@ static int sa_ul_remove(struct platform_device *pdev)
 
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 static struct platform_driver sa_ul_driver = {
 	.probe = sa_ul_probe,
-	.remove = sa_ul_remove,
+	.remove_new = sa_ul_remove,
 	.driver = {
 		   .name = "saul-crypto",
 		   .of_match_table = of_match,
-- 
2.42.0


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

* [PATCH 37/42] crypto: sahara - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (35 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 36/42] crypto: sa2ul " Uwe Kleine-König
@ 2023-10-20  7:55 ` Uwe Kleine-König
  2023-10-20  7:56 ` [PATCH 38/42] crypto: stm32/crc32 " Uwe Kleine-König
                   ` (4 subsequent siblings)
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:55 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: 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/sahara.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c
index 62d93526920f..02065131c300 100644
--- a/drivers/crypto/sahara.c
+++ b/drivers/crypto/sahara.c
@@ -1510,7 +1510,7 @@ static int sahara_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int sahara_remove(struct platform_device *pdev)
+static void sahara_remove(struct platform_device *pdev)
 {
 	struct sahara_dev *dev = platform_get_drvdata(pdev);
 
@@ -1522,13 +1522,11 @@ static int sahara_remove(struct platform_device *pdev)
 	clk_disable_unprepare(dev->clk_ahb);
 
 	dev_ptr = NULL;
-
-	return 0;
 }
 
 static struct platform_driver sahara_driver = {
 	.probe		= sahara_probe,
-	.remove		= sahara_remove,
+	.remove_new	= sahara_remove,
 	.driver		= {
 		.name	= SAHARA_NAME,
 		.of_match_table = sahara_dt_ids,
-- 
2.42.0


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

* [PATCH 38/42] crypto: stm32/crc32 - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (36 preceding siblings ...)
  2023-10-20  7:55 ` [PATCH 37/42] crypto: sahara " 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
                   ` (3 subsequent siblings)
  41 siblings, 0 replies; 69+ 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


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

* [PATCH 39/42] crypto: stm32/cryp - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (37 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 40/42] crypto: talitos " Uwe Kleine-König
                   ` (2 subsequent siblings)
  41 siblings, 0 replies; 69+ 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


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

* [PATCH 40/42] crypto: talitos - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (38 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  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
  41 siblings, 0 replies; 69+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  7:56 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller; +Cc: 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/talitos.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 4ca4fbd227bc..e603c0f2abca 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -3136,7 +3136,7 @@ static int hw_supports(struct device *dev, __be32 desc_hdr_template)
 	return ret;
 }
 
-static int talitos_remove(struct platform_device *ofdev)
+static void talitos_remove(struct platform_device *ofdev)
 {
 	struct device *dev = &ofdev->dev;
 	struct talitos_private *priv = dev_get_drvdata(dev);
@@ -3170,8 +3170,6 @@ static int talitos_remove(struct platform_device *ofdev)
 	tasklet_kill(&priv->done_task[0]);
 	if (priv->irq[1])
 		tasklet_kill(&priv->done_task[1]);
-
-	return 0;
 }
 
 static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,
@@ -3559,7 +3557,7 @@ static struct platform_driver talitos_driver = {
 		.of_match_table = talitos_match,
 	},
 	.probe = talitos_probe,
-	.remove = talitos_remove,
+	.remove_new = talitos_remove,
 };
 
 module_platform_driver(talitos_driver);
-- 
2.42.0


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

* [PATCH 41/42] crypto: xilinx/zynqmp-aes-gcm - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (39 preceding siblings ...)
  2023-10-20  7:56 ` [PATCH 40/42] crypto: talitos " 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
  41 siblings, 1 reply; 69+ 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


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

* [PATCH 42/42] crypto: xilinx/zynqmp-sha - Convert to platform remove callback returning void
  2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (40 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
  41 siblings, 1 reply; 69+ 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


^ permalink raw reply related	[flat|nested] 69+ 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; 69+ 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>



^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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


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

* Re: [PATCH 35/42] crypto: s5p-sss - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 35/42] crypto: s5p-sss " Uwe Kleine-König
@ 2023-10-20  8:18   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 69+ 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: Vladimir Zapolskiy, linux-crypto, linux-samsung-soc, 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


^ permalink raw reply	[flat|nested] 69+ 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; 69+ messages in thread
From: Hari.PrasathGE @ 2023-10-20  8:49 UTC (permalink / raw)
  To: u.kleine-koenig, herbert, davem
  Cc: alexandre.belloni, claudiu.beznea, linux-crypto, kernel,
	linux-arm-kernel, Nicolas.Ferre, Ryan.Wanner



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

^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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

^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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

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

* Re: [PATCH 19/42] crypto: hisilicon/trng - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 19/42] crypto: hisilicon/trng " Uwe Kleine-König
@ 2023-10-20  9:39   ` Weili Qian
  0 siblings, 0 replies; 69+ messages in thread
From: Weili Qian @ 2023-10-20  9:39 UTC (permalink / raw)
  To: Uwe Kleine-König, Herbert Xu, David S. Miller; +Cc: linux-crypto, kernel



On 2023/10/20 15: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.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/crypto/hisilicon/trng/trng.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/hisilicon/trng/trng.c b/drivers/crypto/hisilicon/trng/trng.c
> index 97e500db0a82..451b167bcc73 100644
> --- a/drivers/crypto/hisilicon/trng/trng.c
> +++ b/drivers/crypto/hisilicon/trng/trng.c
> @@ -303,7 +303,7 @@ static int hisi_trng_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int hisi_trng_remove(struct platform_device *pdev)
> +static void hisi_trng_remove(struct platform_device *pdev)
>  {
>  	struct hisi_trng *trng = platform_get_drvdata(pdev);
>  
> @@ -314,8 +314,6 @@ static int hisi_trng_remove(struct platform_device *pdev)
>  	if (trng->ver != HISI_TRNG_VER_V1 &&
>  	    atomic_dec_return(&trng_active_devs) == 0)
>  		crypto_unregister_rng(&hisi_trng_alg);
> -
> -	return 0;
>  }
>  
>  static const struct acpi_device_id hisi_trng_acpi_match[] = {
> @@ -326,7 +324,7 @@ MODULE_DEVICE_TABLE(acpi, hisi_trng_acpi_match);
>  
>  static struct platform_driver hisi_trng_driver = {
>  	.probe		= hisi_trng_probe,
> -	.remove         = hisi_trng_remove,
> +	.remove_new     = hisi_trng_remove,
>  	.driver		= {
>  		.name	= "hisi-trng-v2",
>  		.acpi_match_table = ACPI_PTR(hisi_trng_acpi_match),
> 

Reviewed-by: Weili Qian <qianweili@huawei.com>

Thanks,
Weili

^ permalink raw reply	[flat|nested] 69+ 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 - " 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; 69+ 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,


^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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,


^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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,


^ permalink raw reply	[flat|nested] 69+ 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 - " 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; 69+ 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,
> 





^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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,
> 





^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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,
> 





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

* Re: [PATCH 14/42] crypto: ccp/sp - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 14/42] crypto: ccp/sp " Uwe Kleine-König
@ 2023-10-20 18:00   ` Tom Lendacky
  0 siblings, 0 replies; 69+ messages in thread
From: Tom Lendacky @ 2023-10-20 18:00 UTC (permalink / raw)
  To: Uwe Kleine-König, Herbert Xu, David S. Miller
  Cc: John Allen, linux-crypto, kernel

On 10/20/23 02: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.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Acked-by: Tom Lendacky <thomas.lendacky@amd.com>

> ---
>   drivers/crypto/ccp/sp-platform.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c
> index 7d79a8744f9a..473301237760 100644
> --- a/drivers/crypto/ccp/sp-platform.c
> +++ b/drivers/crypto/ccp/sp-platform.c
> @@ -180,7 +180,7 @@ static int sp_platform_probe(struct platform_device *pdev)
>   	return ret;
>   }
>   
> -static int sp_platform_remove(struct platform_device *pdev)
> +static void sp_platform_remove(struct platform_device *pdev)
>   {
>   	struct device *dev = &pdev->dev;
>   	struct sp_device *sp = dev_get_drvdata(dev);
> @@ -188,8 +188,6 @@ static int sp_platform_remove(struct platform_device *pdev)
>   	sp_destroy(sp);
>   
>   	dev_notice(dev, "disabled\n");
> -
> -	return 0;
>   }
>   
>   #ifdef CONFIG_PM
> @@ -222,7 +220,7 @@ static struct platform_driver sp_platform_driver = {
>   #endif
>   	},
>   	.probe = sp_platform_probe,
> -	.remove = sp_platform_remove,
> +	.remove_new = sp_platform_remove,
>   #ifdef CONFIG_PM
>   	.suspend = sp_platform_suspend,
>   	.resume = sp_platform_resume,

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

* Re: [PATCH 33/42] crypto: qcom-rng - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 33/42] crypto: qcom-rng " Uwe Kleine-König
@ 2023-10-21 17:23   ` Konrad Dybcio
  0 siblings, 0 replies; 69+ messages in thread
From: Konrad Dybcio @ 2023-10-21 17:23 UTC (permalink / raw)
  To: Uwe Kleine-König, Herbert Xu, David S. Miller
  Cc: Andy Gross, Bjorn Andersson, linux-arm-msm, linux-crypto, kernel



On 10/20/23 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.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad

^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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>

^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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>

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

* Re: [PATCH 11/42] crypto: axis/artpec6 - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 11/42] crypto: axis/artpec6 " Uwe Kleine-König
@ 2023-10-23  7:36   ` Jesper Nilsson
  0 siblings, 0 replies; 69+ messages in thread
From: Jesper Nilsson @ 2023-10-23  7:36 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Herbert Xu, David S. Miller, Jesper Nilsson, Lars Persson,
	linux-arm-kernel, linux-crypto, kernel

On Fri, Oct 20, 2023 at 09:55:33AM +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>

Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>


/^JN - Jesper Nilsson
-- 
               Jesper Nilsson -- jesper.nilsson@axis.com

^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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

^ permalink raw reply	[flat|nested] 69+ 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 - " 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; 69+ 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

^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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

^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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

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

* Re: [PATCH 05/42] crypto: amlogic-gxl-core - Convert to platform remove callback returning void
  2023-10-20  7:55 ` [PATCH 05/42] crypto: amlogic-gxl-core " Uwe Kleine-König
@ 2023-10-25 13:30   ` Corentin LABBE
  0 siblings, 0 replies; 69+ 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, linux-crypto, linux-amlogic, kernel

Le Fri, Oct 20, 2023 at 09:55:27AM +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/amlogic/amlogic-gxl-core.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/amlogic/amlogic-gxl-core.c b/drivers/crypto/amlogic/amlogic-gxl-core.c
> index da6dfe0f9ac3..f54ab0d0b1e8 100644
> --- a/drivers/crypto/amlogic/amlogic-gxl-core.c
> +++ b/drivers/crypto/amlogic/amlogic-gxl-core.c
> @@ -299,7 +299,7 @@ static int meson_crypto_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int meson_crypto_remove(struct platform_device *pdev)
> +static void meson_crypto_remove(struct platform_device *pdev)
>  {
>  	struct meson_dev *mc = platform_get_drvdata(pdev);
>  
> @@ -312,7 +312,6 @@ static int meson_crypto_remove(struct platform_device *pdev)
>  	meson_free_chanlist(mc, MAXFLOW - 1);
>  
>  	clk_disable_unprepare(mc->busclk);
> -	return 0;
>  }
>  
>  static const struct of_device_id meson_crypto_of_match_table[] = {
> @@ -323,7 +322,7 @@ MODULE_DEVICE_TABLE(of, meson_crypto_of_match_table);
>  
>  static struct platform_driver meson_crypto_driver = {
>  	.probe		 = meson_crypto_probe,
> -	.remove		 = meson_crypto_remove,
> +	.remove_new	 = meson_crypto_remove,
>  	.driver		 = {
>  		.name		   = "gxl-crypto",
>  		.of_match_table	= meson_crypto_of_match_table,
> -- 
> 2.42.0
> 

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

Thanks

^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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

^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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

^ permalink raw reply	[flat|nested] 69+ 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; 69+ 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

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

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

Thread overview: 69+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-20  7:55 [PATCH 00/42] crypto: Convert to platform remove callback returning void Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 01/42] crypto: sun4i-ss - " 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 04/42] crypto: amcc/crypto4xx " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 05/42] crypto: amlogic-gxl-core " Uwe Kleine-König
2023-10-25 13:30   ` 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 11/42] crypto: axis/artpec6 " Uwe Kleine-König
2023-10-23  7:36   ` Jesper Nilsson
2023-10-20  7:55 ` [PATCH 12/42] crypto: bcm/cipher " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 13/42] crypto: caam/jr " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 14/42] crypto: ccp/sp " Uwe Kleine-König
2023-10-20 18:00   ` Tom Lendacky
2023-10-20  7:55 ` [PATCH 15/42] crypto: ccree/cc " 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 18/42] crypto: hisilicon/sec " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 19/42] crypto: hisilicon/trng " Uwe Kleine-König
2023-10-20  9:39   ` Weili Qian
2023-10-20  7:55 ` [PATCH 20/42] crypto: img-hash " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 21/42] crypto: inside-secure/safexcel " Uwe Kleine-König
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 23/42] crypto: intel/keembay-ocs-aes " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 24/42] crypto: intel/keembay-ocs-ecc " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 25/42] crypto: intel/keembay-ocs-hcu " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 26/42] crypto: marvell/cesa " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 27/42] crypto: mxs-dcp " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 28/42] crypto: n2_core " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 29/42] crypto: omap-aes " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 30/42] crypto: omap-des " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 31/42] crypto: omap-sham " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 32/42] crypto: qce " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 33/42] crypto: qcom-rng " Uwe Kleine-König
2023-10-21 17:23   ` Konrad Dybcio
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:55 ` [PATCH 35/42] crypto: s5p-sss " Uwe Kleine-König
2023-10-20  8:18   ` Krzysztof Kozlowski
2023-10-20  7:55 ` [PATCH 36/42] crypto: sa2ul " Uwe Kleine-König
2023-10-20  7:55 ` [PATCH 37/42] crypto: sahara " Uwe Kleine-König
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 40/42] crypto: talitos " 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).