public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 07/49] mtd: rawnand: atmel: Convert to platform remove callback returning void
       [not found] <20230401161938.2503204-1-u.kleine-koenig@pengutronix.de>
@ 2023-04-01 16:18 ` Uwe Kleine-König
  2023-04-03  8:37   ` Nicolas Ferre
  2023-04-01 16:19 ` [PATCH 22/49] mtd: rawnand: lpc32xx_mlc: " Uwe Kleine-König
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2023-04-01 16:18 UTC (permalink / raw)
  To: Tudor Ambarus, Miquel Raynal, Vignesh Raghavendra, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea
  Cc: Richard Weinberger, linux-mtd, 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.

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/mtd/nand/raw/atmel/nand-controller.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
index 41c6bd6e2d72..81e3d682a8cd 100644
--- a/drivers/mtd/nand/raw/atmel/nand-controller.c
+++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
@@ -2626,13 +2626,11 @@ static int atmel_nand_controller_probe(struct platform_device *pdev)
 	return caps->ops->probe(pdev, caps);
 }
 
-static int atmel_nand_controller_remove(struct platform_device *pdev)
+static void atmel_nand_controller_remove(struct platform_device *pdev)
 {
 	struct atmel_nand_controller *nc = platform_get_drvdata(pdev);
 
 	WARN_ON(nc->caps->ops->remove(nc));
-
-	return 0;
 }
 
 static __maybe_unused int atmel_nand_controller_resume(struct device *dev)
@@ -2663,7 +2661,7 @@ static struct platform_driver atmel_nand_controller_driver = {
 		.pm = &atmel_nand_controller_pm_ops,
 	},
 	.probe = atmel_nand_controller_probe,
-	.remove = atmel_nand_controller_remove,
+	.remove_new = atmel_nand_controller_remove,
 };
 module_platform_driver(atmel_nand_controller_driver);
 
-- 
2.39.2


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

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

* [PATCH 22/49] mtd: rawnand: lpc32xx_mlc: Convert to platform remove callback returning void
       [not found] <20230401161938.2503204-1-u.kleine-koenig@pengutronix.de>
  2023-04-01 16:18 ` [PATCH 07/49] mtd: rawnand: atmel: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-04-01 16:19 ` Uwe Kleine-König
  2023-04-01 16:19 ` [PATCH 23/49] mtd: rawnand: lpc32xx_slc: " Uwe Kleine-König
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2023-04-01 16:19 UTC (permalink / raw)
  To: Miquel Raynal, Vignesh Raghavendra, Vladimir Zapolskiy,
	Geert Uytterhoeven, Dmitry Torokhov
  Cc: Richard Weinberger, linux-mtd, 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.

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/mtd/nand/raw/lpc32xx_mlc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/lpc32xx_mlc.c b/drivers/mtd/nand/raw/lpc32xx_mlc.c
index ae7f6429a5f6..b3136ae6f4e9 100644
--- a/drivers/mtd/nand/raw/lpc32xx_mlc.c
+++ b/drivers/mtd/nand/raw/lpc32xx_mlc.c
@@ -827,7 +827,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
 /*
  * Remove NAND device
  */
-static int lpc32xx_nand_remove(struct platform_device *pdev)
+static void lpc32xx_nand_remove(struct platform_device *pdev)
 {
 	struct lpc32xx_nand_host *host = platform_get_drvdata(pdev);
 	struct nand_chip *chip = &host->nand_chip;
@@ -846,8 +846,6 @@ static int lpc32xx_nand_remove(struct platform_device *pdev)
 
 	lpc32xx_wp_enable(host);
 	gpiod_put(host->wp_gpio);
-
-	return 0;
 }
 
 static int lpc32xx_nand_resume(struct platform_device *pdev)
@@ -889,7 +887,7 @@ MODULE_DEVICE_TABLE(of, lpc32xx_nand_match);
 
 static struct platform_driver lpc32xx_nand_driver = {
 	.probe		= lpc32xx_nand_probe,
-	.remove		= lpc32xx_nand_remove,
+	.remove_new	= lpc32xx_nand_remove,
 	.resume		= pm_ptr(lpc32xx_nand_resume),
 	.suspend	= pm_ptr(lpc32xx_nand_suspend),
 	.driver		= {
-- 
2.39.2


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

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

* [PATCH 23/49] mtd: rawnand: lpc32xx_slc: Convert to platform remove callback returning void
       [not found] <20230401161938.2503204-1-u.kleine-koenig@pengutronix.de>
  2023-04-01 16:18 ` [PATCH 07/49] mtd: rawnand: atmel: Convert to platform remove callback returning void Uwe Kleine-König
  2023-04-01 16:19 ` [PATCH 22/49] mtd: rawnand: lpc32xx_mlc: " Uwe Kleine-König
@ 2023-04-01 16:19 ` Uwe Kleine-König
  2023-04-01 16:19 ` [PATCH 25/49] mtd: rawnand: meson: " Uwe Kleine-König
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2023-04-01 16:19 UTC (permalink / raw)
  To: Miquel Raynal, Vignesh Raghavendra, Vladimir Zapolskiy,
	Geert Uytterhoeven, Dmitry Torokhov
  Cc: Richard Weinberger, linux-mtd, 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.

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/mtd/nand/raw/lpc32xx_slc.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/lpc32xx_slc.c b/drivers/mtd/nand/raw/lpc32xx_slc.c
index 6918737346c9..3139b6107660 100644
--- a/drivers/mtd/nand/raw/lpc32xx_slc.c
+++ b/drivers/mtd/nand/raw/lpc32xx_slc.c
@@ -946,7 +946,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
 /*
  * Remove NAND device.
  */
-static int lpc32xx_nand_remove(struct platform_device *pdev)
+static void lpc32xx_nand_remove(struct platform_device *pdev)
 {
 	uint32_t tmp;
 	struct lpc32xx_nand_host *host = platform_get_drvdata(pdev);
@@ -965,8 +965,6 @@ static int lpc32xx_nand_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(host->clk);
 	lpc32xx_wp_enable(host);
-
-	return 0;
 }
 
 static int lpc32xx_nand_resume(struct platform_device *pdev)
@@ -1015,7 +1013,7 @@ MODULE_DEVICE_TABLE(of, lpc32xx_nand_match);
 
 static struct platform_driver lpc32xx_nand_driver = {
 	.probe		= lpc32xx_nand_probe,
-	.remove		= lpc32xx_nand_remove,
+	.remove_new	= lpc32xx_nand_remove,
 	.resume		= pm_ptr(lpc32xx_nand_resume),
 	.suspend	= pm_ptr(lpc32xx_nand_suspend),
 	.driver		= {
-- 
2.39.2


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

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

* [PATCH 25/49] mtd: rawnand: meson: Convert to platform remove callback returning void
       [not found] <20230401161938.2503204-1-u.kleine-koenig@pengutronix.de>
                   ` (2 preceding siblings ...)
  2023-04-01 16:19 ` [PATCH 23/49] mtd: rawnand: lpc32xx_slc: " Uwe Kleine-König
@ 2023-04-01 16:19 ` Uwe Kleine-König
  2023-04-01 21:31   ` Martin Blumenstingl
  2023-04-01 16:19 ` [PATCH 27/49] mtd: rawnand: mtk: " Uwe Kleine-König
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2023-04-01 16:19 UTC (permalink / raw)
  To: Liang Yang, Miquel Raynal, Vignesh Raghavendra, Neil Armstrong,
	Kevin Hilman
  Cc: Richard Weinberger, Jerome Brunet, Martin Blumenstingl, linux-mtd,
	linux-arm-kernel, 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 (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.

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/mtd/nand/raw/meson_nand.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
index 5ee01231ac4c..24f1ad025cda 100644
--- a/drivers/mtd/nand/raw/meson_nand.c
+++ b/drivers/mtd/nand/raw/meson_nand.c
@@ -1434,20 +1434,18 @@ static int meson_nfc_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int meson_nfc_remove(struct platform_device *pdev)
+static void meson_nfc_remove(struct platform_device *pdev)
 {
 	struct meson_nfc *nfc = platform_get_drvdata(pdev);
 
 	meson_nfc_nand_chip_cleanup(nfc);
 
 	meson_nfc_disable_clk(nfc);
-
-	return 0;
 }
 
 static struct platform_driver meson_nfc_driver = {
 	.probe  = meson_nfc_probe,
-	.remove = meson_nfc_remove,
+	.remove_new = meson_nfc_remove,
 	.driver = {
 		.name  = "meson-nand",
 		.of_match_table = meson_nfc_id_table,
-- 
2.39.2


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

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

* [PATCH 27/49] mtd: rawnand: mtk: Convert to platform remove callback returning void
       [not found] <20230401161938.2503204-1-u.kleine-koenig@pengutronix.de>
                   ` (3 preceding siblings ...)
  2023-04-01 16:19 ` [PATCH 25/49] mtd: rawnand: meson: " Uwe Kleine-König
@ 2023-04-01 16:19 ` Uwe Kleine-König
  2023-04-01 16:19 ` [PATCH 34/49] mtd: rawnand: oxnas: " Uwe Kleine-König
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2023-04-01 16:19 UTC (permalink / raw)
  To: Miquel Raynal, Vignesh Raghavendra, Matthias Brugger,
	Chuanhong Guo
  Cc: Richard Weinberger, AngeloGioacchino Del Regno, linux-mtd, kernel,
	linux-arm-kernel, linux-mediatek

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.

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/mtd/nand/raw/mtk_nand.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c
index d540454cbbdf..b2fa6b2074ab 100644
--- a/drivers/mtd/nand/raw/mtk_nand.c
+++ b/drivers/mtd/nand/raw/mtk_nand.c
@@ -1601,7 +1601,7 @@ static int mtk_nfc_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int mtk_nfc_remove(struct platform_device *pdev)
+static void mtk_nfc_remove(struct platform_device *pdev)
 {
 	struct mtk_nfc *nfc = platform_get_drvdata(pdev);
 	struct mtk_nfc_nand_chip *mtk_chip;
@@ -1620,8 +1620,6 @@ static int mtk_nfc_remove(struct platform_device *pdev)
 
 	mtk_ecc_release(nfc->ecc);
 	mtk_nfc_disable_clk(&nfc->clk);
-
-	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -1663,7 +1661,7 @@ static SIMPLE_DEV_PM_OPS(mtk_nfc_pm_ops, mtk_nfc_suspend, mtk_nfc_resume);
 
 static struct platform_driver mtk_nfc_driver = {
 	.probe  = mtk_nfc_probe,
-	.remove = mtk_nfc_remove,
+	.remove_new = mtk_nfc_remove,
 	.driver = {
 		.name  = MTK_NAME,
 		.of_match_table = mtk_nfc_id_table,
-- 
2.39.2


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

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

* [PATCH 34/49] mtd: rawnand: oxnas: Convert to platform remove callback returning void
       [not found] <20230401161938.2503204-1-u.kleine-koenig@pengutronix.de>
                   ` (4 preceding siblings ...)
  2023-04-01 16:19 ` [PATCH 27/49] mtd: rawnand: mtk: " Uwe Kleine-König
@ 2023-04-01 16:19 ` Uwe Kleine-König
  2023-04-01 16:19 ` [PATCH 40/49] mtd: rawnand: rockchip: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2023-04-01 16:19 UTC (permalink / raw)
  To: Miquel Raynal, Vignesh Raghavendra, Neil Armstrong
  Cc: Richard Weinberger, linux-mtd, linux-arm-kernel, linux-oxnas,
	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.

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/mtd/nand/raw/oxnas_nand.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/oxnas_nand.c b/drivers/mtd/nand/raw/oxnas_nand.c
index cd112d45e0b5..e3c9807df1cd 100644
--- a/drivers/mtd/nand/raw/oxnas_nand.c
+++ b/drivers/mtd/nand/raw/oxnas_nand.c
@@ -171,7 +171,7 @@ static int oxnas_nand_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int oxnas_nand_remove(struct platform_device *pdev)
+static void oxnas_nand_remove(struct platform_device *pdev)
 {
 	struct oxnas_nand_ctrl *oxnas = platform_get_drvdata(pdev);
 	struct nand_chip *chip;
@@ -184,8 +184,6 @@ static int oxnas_nand_remove(struct platform_device *pdev)
 	}
 
 	clk_disable_unprepare(oxnas->clk);
-
-	return 0;
 }
 
 static const struct of_device_id oxnas_nand_match[] = {
@@ -196,7 +194,7 @@ MODULE_DEVICE_TABLE(of, oxnas_nand_match);
 
 static struct platform_driver oxnas_nand_driver = {
 	.probe	= oxnas_nand_probe,
-	.remove	= oxnas_nand_remove,
+	.remove_new = oxnas_nand_remove,
 	.driver	= {
 		.name		= "oxnas_nand",
 		.of_match_table = oxnas_nand_match,
-- 
2.39.2


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

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

* [PATCH 40/49] mtd: rawnand: rockchip: Convert to platform remove callback returning void
       [not found] <20230401161938.2503204-1-u.kleine-koenig@pengutronix.de>
                   ` (5 preceding siblings ...)
  2023-04-01 16:19 ` [PATCH 34/49] mtd: rawnand: oxnas: " Uwe Kleine-König
@ 2023-04-01 16:19 ` Uwe Kleine-König
  2023-04-01 19:04   ` Heiko Stübner
  2023-04-01 16:19 ` [PATCH 45/49] mtd: rawnand: stm32_fmc2: " Uwe Kleine-König
  2023-04-01 16:19 ` [PATCH 46/49] mtd: rawnand: sunxi: " Uwe Kleine-König
  8 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2023-04-01 16:19 UTC (permalink / raw)
  To: Miquel Raynal, Vignesh Raghavendra, Heiko Stuebner, Phil Edworthy
  Cc: Richard Weinberger, linux-mtd, 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 (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.

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/mtd/nand/raw/rockchip-nand-controller.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/rockchip-nand-controller.c b/drivers/mtd/nand/raw/rockchip-nand-controller.c
index f133985cc053..2312e27362cb 100644
--- a/drivers/mtd/nand/raw/rockchip-nand-controller.c
+++ b/drivers/mtd/nand/raw/rockchip-nand-controller.c
@@ -1427,7 +1427,7 @@ static int rk_nfc_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int rk_nfc_remove(struct platform_device *pdev)
+static void rk_nfc_remove(struct platform_device *pdev)
 {
 	struct rk_nfc *nfc = platform_get_drvdata(pdev);
 
@@ -1435,8 +1435,6 @@ static int rk_nfc_remove(struct platform_device *pdev)
 	kfree(nfc->oob_buf);
 	rk_nfc_chips_cleanup(nfc);
 	rk_nfc_disable_clks(nfc);
-
-	return 0;
 }
 
 static int __maybe_unused rk_nfc_suspend(struct device *dev)
@@ -1476,7 +1474,7 @@ static const struct dev_pm_ops rk_nfc_pm_ops = {
 
 static struct platform_driver rk_nfc_driver = {
 	.probe = rk_nfc_probe,
-	.remove = rk_nfc_remove,
+	.remove_new = rk_nfc_remove,
 	.driver = {
 		.name = "rockchip-nfc",
 		.of_match_table = rk_nfc_id_table,
-- 
2.39.2


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

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

* [PATCH 45/49] mtd: rawnand: stm32_fmc2: Convert to platform remove callback returning void
       [not found] <20230401161938.2503204-1-u.kleine-koenig@pengutronix.de>
                   ` (6 preceding siblings ...)
  2023-04-01 16:19 ` [PATCH 40/49] mtd: rawnand: rockchip: " Uwe Kleine-König
@ 2023-04-01 16:19 ` Uwe Kleine-König
  2023-04-01 16:19 ` [PATCH 46/49] mtd: rawnand: sunxi: " Uwe Kleine-König
  8 siblings, 0 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2023-04-01 16:19 UTC (permalink / raw)
  To: Miquel Raynal, Vignesh Raghavendra, Maxime Coquelin,
	Alexandre Torgue, Christophe Kerello, Dmitry Torokhov, Jack Wang
  Cc: Richard Weinberger, linux-mtd, 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.

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/mtd/nand/raw/stm32_fmc2_nand.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
index 5d627048c420..e3d09dd5963b 100644
--- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c
+++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
@@ -2021,7 +2021,7 @@ static int stm32_fmc2_nfc_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int stm32_fmc2_nfc_remove(struct platform_device *pdev)
+static void stm32_fmc2_nfc_remove(struct platform_device *pdev)
 {
 	struct stm32_fmc2_nfc *nfc = platform_get_drvdata(pdev);
 	struct stm32_fmc2_nand *nand = &nfc->nand;
@@ -2045,8 +2045,6 @@ static int stm32_fmc2_nfc_remove(struct platform_device *pdev)
 	clk_disable_unprepare(nfc->clk);
 
 	stm32_fmc2_nfc_wp_enable(nand);
-
-	return 0;
 }
 
 static int __maybe_unused stm32_fmc2_nfc_suspend(struct device *dev)
@@ -2103,7 +2101,7 @@ MODULE_DEVICE_TABLE(of, stm32_fmc2_nfc_match);
 
 static struct platform_driver stm32_fmc2_nfc_driver = {
 	.probe	= stm32_fmc2_nfc_probe,
-	.remove	= stm32_fmc2_nfc_remove,
+	.remove_new = stm32_fmc2_nfc_remove,
 	.driver	= {
 		.name = "stm32_fmc2_nfc",
 		.of_match_table = stm32_fmc2_nfc_match,
-- 
2.39.2


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

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

* [PATCH 46/49] mtd: rawnand: sunxi: Convert to platform remove callback returning void
       [not found] <20230401161938.2503204-1-u.kleine-koenig@pengutronix.de>
                   ` (7 preceding siblings ...)
  2023-04-01 16:19 ` [PATCH 45/49] mtd: rawnand: stm32_fmc2: " Uwe Kleine-König
@ 2023-04-01 16:19 ` Uwe Kleine-König
  2023-04-01 16:31   ` Jernej Škrabec
  8 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2023-04-01 16:19 UTC (permalink / raw)
  To: Miquel Raynal, Vignesh Raghavendra, Chen-Yu Tsai, Jernej Skrabec,
	Samuel Holland
  Cc: Richard Weinberger, linux-mtd, 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 (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.

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/mtd/nand/raw/sunxi_nand.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
index 13e3e0198d15..9884304634f6 100644
--- a/drivers/mtd/nand/raw/sunxi_nand.c
+++ b/drivers/mtd/nand/raw/sunxi_nand.c
@@ -2173,7 +2173,7 @@ static int sunxi_nfc_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int sunxi_nfc_remove(struct platform_device *pdev)
+static void sunxi_nfc_remove(struct platform_device *pdev)
 {
 	struct sunxi_nfc *nfc = platform_get_drvdata(pdev);
 
@@ -2185,8 +2185,6 @@ static int sunxi_nfc_remove(struct platform_device *pdev)
 		dma_release_channel(nfc->dmac);
 	clk_disable_unprepare(nfc->mod_clk);
 	clk_disable_unprepare(nfc->ahb_clk);
-
-	return 0;
 }
 
 static const struct sunxi_nfc_caps sunxi_nfc_a10_caps = {
@@ -2219,7 +2217,7 @@ static struct platform_driver sunxi_nfc_driver = {
 		.of_match_table = sunxi_nfc_ids,
 	},
 	.probe = sunxi_nfc_probe,
-	.remove = sunxi_nfc_remove,
+	.remove_new = sunxi_nfc_remove,
 };
 module_platform_driver(sunxi_nfc_driver);
 
-- 
2.39.2


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

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

* Re: [PATCH 46/49] mtd: rawnand: sunxi: Convert to platform remove callback returning void
  2023-04-01 16:19 ` [PATCH 46/49] mtd: rawnand: sunxi: " Uwe Kleine-König
@ 2023-04-01 16:31   ` Jernej Škrabec
  0 siblings, 0 replies; 13+ messages in thread
From: Jernej Škrabec @ 2023-04-01 16:31 UTC (permalink / raw)
  To: Miquel Raynal, Vignesh Raghavendra, Chen-Yu Tsai, Samuel Holland,
	Uwe Kleine-König
  Cc: Richard Weinberger, linux-mtd, linux-arm-kernel, linux-sunxi,
	kernel

Dne sobota, 01. april 2023 ob 18:19:35 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 (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.
> 
> 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: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej



_______________________________________________
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] 13+ messages in thread

* Re: [PATCH 40/49] mtd: rawnand: rockchip: Convert to platform remove callback returning void
  2023-04-01 16:19 ` [PATCH 40/49] mtd: rawnand: rockchip: " Uwe Kleine-König
@ 2023-04-01 19:04   ` Heiko Stübner
  0 siblings, 0 replies; 13+ messages in thread
From: Heiko Stübner @ 2023-04-01 19:04 UTC (permalink / raw)
  To: Miquel Raynal, Vignesh Raghavendra, Phil Edworthy,
	Uwe Kleine-König
  Cc: Richard Weinberger, linux-mtd, linux-arm-kernel, linux-rockchip,
	kernel

Am Samstag, 1. April 2023, 18:19:29 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 (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.
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

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



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

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

* Re: [PATCH 25/49] mtd: rawnand: meson: Convert to platform remove callback returning void
  2023-04-01 16:19 ` [PATCH 25/49] mtd: rawnand: meson: " Uwe Kleine-König
@ 2023-04-01 21:31   ` Martin Blumenstingl
  0 siblings, 0 replies; 13+ messages in thread
From: Martin Blumenstingl @ 2023-04-01 21:31 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Liang Yang, Miquel Raynal, Vignesh Raghavendra, Neil Armstrong,
	Kevin Hilman, Richard Weinberger, Jerome Brunet, linux-mtd,
	linux-arm-kernel, linux-amlogic, kernel

On Sat, Apr 1, 2023 at 6:19 PM Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> 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 (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.
>
> 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: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

_______________________________________________
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] 13+ messages in thread

* Re: [PATCH 07/49] mtd: rawnand: atmel: Convert to platform remove callback returning void
  2023-04-01 16:18 ` [PATCH 07/49] mtd: rawnand: atmel: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-04-03  8:37   ` Nicolas Ferre
  0 siblings, 0 replies; 13+ messages in thread
From: Nicolas Ferre @ 2023-04-03  8:37 UTC (permalink / raw)
  To: Uwe Kleine-König, Tudor Ambarus, Miquel Raynal,
	Vignesh Raghavendra, Alexandre Belloni, Claudiu Beznea,
	Balamanikandan Gunasundar
  Cc: Richard Weinberger, linux-mtd, linux-arm-kernel, kernel

On 01/04/2023 at 18:18, 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 (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.
> 
> 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>

Ok for me:
Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

Thanks Uwe for having taken care of this driver. Best regards,
   Nicolas

> ---
>   drivers/mtd/nand/raw/atmel/nand-controller.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c
> index 41c6bd6e2d72..81e3d682a8cd 100644
> --- a/drivers/mtd/nand/raw/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c
> @@ -2626,13 +2626,11 @@ static int atmel_nand_controller_probe(struct platform_device *pdev)
>          return caps->ops->probe(pdev, caps);
>   }
> 
> -static int atmel_nand_controller_remove(struct platform_device *pdev)
> +static void atmel_nand_controller_remove(struct platform_device *pdev)
>   {
>          struct atmel_nand_controller *nc = platform_get_drvdata(pdev);
> 
>          WARN_ON(nc->caps->ops->remove(nc));
> -
> -       return 0;
>   }
> 
>   static __maybe_unused int atmel_nand_controller_resume(struct device *dev)
> @@ -2663,7 +2661,7 @@ static struct platform_driver atmel_nand_controller_driver = {
>                  .pm = &atmel_nand_controller_pm_ops,
>          },
>          .probe = atmel_nand_controller_probe,
> -       .remove = atmel_nand_controller_remove,
> +       .remove_new = atmel_nand_controller_remove,
>   };
>   module_platform_driver(atmel_nand_controller_driver);
> 
> --
> 2.39.2
> 

-- 
Nicolas Ferre


_______________________________________________
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] 13+ messages in thread

end of thread, other threads:[~2023-04-03  8:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230401161938.2503204-1-u.kleine-koenig@pengutronix.de>
2023-04-01 16:18 ` [PATCH 07/49] mtd: rawnand: atmel: Convert to platform remove callback returning void Uwe Kleine-König
2023-04-03  8:37   ` Nicolas Ferre
2023-04-01 16:19 ` [PATCH 22/49] mtd: rawnand: lpc32xx_mlc: " Uwe Kleine-König
2023-04-01 16:19 ` [PATCH 23/49] mtd: rawnand: lpc32xx_slc: " Uwe Kleine-König
2023-04-01 16:19 ` [PATCH 25/49] mtd: rawnand: meson: " Uwe Kleine-König
2023-04-01 21:31   ` Martin Blumenstingl
2023-04-01 16:19 ` [PATCH 27/49] mtd: rawnand: mtk: " Uwe Kleine-König
2023-04-01 16:19 ` [PATCH 34/49] mtd: rawnand: oxnas: " Uwe Kleine-König
2023-04-01 16:19 ` [PATCH 40/49] mtd: rawnand: rockchip: " Uwe Kleine-König
2023-04-01 19:04   ` Heiko Stübner
2023-04-01 16:19 ` [PATCH 45/49] mtd: rawnand: stm32_fmc2: " Uwe Kleine-König
2023-04-01 16:19 ` [PATCH 46/49] mtd: rawnand: sunxi: " Uwe Kleine-König
2023-04-01 16:31   ` Jernej Škrabec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox