linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/34] watchdog: Convert to platform remove callback returning void
@ 2023-03-03 21:36 Uwe Kleine-König
  2023-03-03 21:36 ` [PATCH 01/34] watchdog: s3c2410: Don't skip cleanup in remove's error path Uwe Kleine-König
                   ` (35 more replies)
  0 siblings, 36 replies; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Wim Van Sebroeck, Guenter Roeck,
	Doug Anderson, Leela Krishna Amudala, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea, Florian Fainelli, Ray Jui,
	Scott Branden, Vladimir Zapolskiy, Patrice Chotard,
	Maxime Coquelin, Alexandre Torgue
  Cc: Alim Akhtar, linux-arm-kernel, linux-samsung-soc, linux-watchdog,
	Broadcom internal kernel review list, linux-rpi-kernel,
	linux-stm32, patches, kernel

Hello,

this patch series adapts the platform drivers below drivers/watchdog to
use the .remove_new() callback. 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 a resource leak. One driver suffering from
this problem (s3c2410) is fixed by the first patch.

By changing the remove callback to return void driver authors cannot
reasonably (but wrongly) assume any more that there happens some kind of
cleanup later.

All watchdog drivers but the above mentioned one returned zero
unconditionally in their remove callback, so they could all be converted
trivially to .remove_new().

Note that this series depends on commit 5c5a7680e67b ("platform: Provide
a remove callback that returns no value") that is already in Linus' tree
but not yet included in a tagged version.

Best regards
Uwe

Uwe Kleine-König (34):
  watchdog: s3c2410: Don't skip cleanup in remove's error path
  watchdog: acquirewdt: Convert to platform remove callback returning void
  watchdog: advantechwdt: Convert to platform remove callback returning void
  watchdog: ar7: Convert to platform remove callback returning void
  watchdog: at91rm9200: Convert to platform remove callback returning void
  watchdog: ath79: Convert to platform remove callback returning void
  watchdog: bcm2835: Convert to platform remove callback returning void
  watchdog: bcm47xx: Convert to platform remove callback returning void
  watchdog: bcm_kona: Convert to platform remove callback returning void
  watchdog: cpwd: Convert to platform remove callback returning void
  watchdog: dw: Convert to platform remove callback returning void
  watchdog: gef: Convert to platform remove callback returning void
  watchdog: geodewdt: Convert to platform remove callback returning void
  watchdog: ib700wdt: Convert to platform remove callback returning void
  watchdog: ie6xx: Convert to platform remove callback returning void
  watchdog: lpc18xx: Convert to platform remove callback returning void
  watchdog: mtx-1: Convert to platform remove callback returning void
  watchdog: nic7018: Convert to platform remove callback returning void
  watchdog: nv_tco: Convert to platform remove callback returning void
  watchdog: omap: Convert to platform remove callback returning void
  watchdog: orion: Convert to platform remove callback returning void
  watchdog: rc32434: Convert to platform remove callback returning void
  watchdog: rdc321x: Convert to platform remove callback returning void
  watchdog: renesas: Convert to platform remove callback returning void
  watchdog: riowd: Convert to platform remove callback returning void
  watchdog: rn5t618: Convert to platform remove callback returning void
  watchdog: rti: Convert to platform remove callback returning void
  watchdog: s3c2410: Convert to platform remove callback returning void
  watchdog: sa1100: Convert to platform remove callback returning void
  watchdog: sch311x: Convert to platform remove callback returning void
  watchdog: shwdt: Convert to platform remove callback returning void
  watchdog: st_lpc: Convert to platform remove callback returning void
  watchdog: stmp3xxx_rtc: Convert to platform remove callback returning void
  watchdog: wm8350: Convert to platform remove callback returning void

 drivers/watchdog/acquirewdt.c       | 6 ++----
 drivers/watchdog/advantechwdt.c     | 6 ++----
 drivers/watchdog/ar7_wdt.c          | 5 ++---
 drivers/watchdog/at91rm9200_wdt.c   | 6 ++----
 drivers/watchdog/ath79_wdt.c        | 5 ++---
 drivers/watchdog/bcm2835_wdt.c      | 6 ++----
 drivers/watchdog/bcm47xx_wdt.c      | 6 ++----
 drivers/watchdog/bcm_kona_wdt.c     | 6 ++----
 drivers/watchdog/cpwd.c             | 6 ++----
 drivers/watchdog/dw_wdt.c           | 6 ++----
 drivers/watchdog/gef_wdt.c          | 6 ++----
 drivers/watchdog/geodewdt.c         | 5 ++---
 drivers/watchdog/ib700wdt.c         | 5 ++---
 drivers/watchdog/ie6xx_wdt.c        | 6 ++----
 drivers/watchdog/lpc18xx_wdt.c      | 6 ++----
 drivers/watchdog/mtx-1_wdt.c        | 5 ++---
 drivers/watchdog/nic7018_wdt.c      | 6 ++----
 drivers/watchdog/nv_tco.c           | 6 ++----
 drivers/watchdog/omap_wdt.c         | 6 ++----
 drivers/watchdog/orion_wdt.c        | 5 ++---
 drivers/watchdog/rc32434_wdt.c      | 5 ++---
 drivers/watchdog/rdc321x_wdt.c      | 6 ++----
 drivers/watchdog/renesas_wdt.c      | 6 ++----
 drivers/watchdog/riowd.c            | 6 ++----
 drivers/watchdog/rn5t618_wdt.c      | 6 ++----
 drivers/watchdog/rti_wdt.c          | 6 ++----
 drivers/watchdog/s3c2410_wdt.c      | 9 ++++-----
 drivers/watchdog/sa1100_wdt.c       | 6 ++----
 drivers/watchdog/sch311x_wdt.c      | 5 ++---
 drivers/watchdog/shwdt.c            | 6 ++----
 drivers/watchdog/st_lpc_wdt.c       | 6 ++----
 drivers/watchdog/stmp3xxx_rtc_wdt.c | 5 ++---
 drivers/watchdog/wm8350_wdt.c       | 5 ++---
 33 files changed, 68 insertions(+), 123 deletions(-)

base-commit: 2eb29d59ddf02e39774abfb60b2030b0b7e27c1f
-- 
2.39.1


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

* [PATCH 01/34] watchdog: s3c2410: Don't skip cleanup in remove's error path
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 16:58   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 02/34] watchdog: acquirewdt: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (34 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Wim Van Sebroeck, Guenter Roeck,
	Doug Anderson, Leela Krishna Amudala
  Cc: Alim Akhtar, linux-arm-kernel, linux-samsung-soc, linux-watchdog, kernel

Returning early in a platform driver's remove callback is wrong. In this
case the watchdog device is never removed although it's parent is gone
which likely can trigger a use-after-free in sysfs. Also the two used
clocks will never be disabled.

Instead only warn if s3c2410wdt_enable() fails and cleanup. Note that
returning 0 is the right thing to do then to suppress another warning
message by the driver core.

Fixes: 4f1f653a68d6 ("watchdog: s3c2410_wdt: use syscon regmap interface to configure pmu register")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/watchdog/s3c2410_wdt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 200ba236a72e..cf104a844a43 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -782,7 +782,8 @@ static int s3c2410wdt_remove(struct platform_device *dev)
 
 	ret = s3c2410wdt_enable(wdt, false);
 	if (ret < 0)
-		return ret;
+		dev_warn(&dev->dev,
+			 "Failed to disable watchdog (%pe)\n", ERR_PTR(ret));
 
 	watchdog_unregister_device(&wdt->wdt_device);
 
-- 
2.39.1


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

* [PATCH 02/34] watchdog: acquirewdt: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
  2023-03-03 21:36 ` [PATCH 01/34] watchdog: s3c2410: Don't skip cleanup in remove's error path Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 17:02   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 03/34] watchdog: advantechwdt: " Uwe Kleine-König
                   ` (33 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/acquirewdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/acquirewdt.c b/drivers/watchdog/acquirewdt.c
index bc6f333565d3..53b04abd55b0 100644
--- a/drivers/watchdog/acquirewdt.c
+++ b/drivers/watchdog/acquirewdt.c
@@ -271,14 +271,12 @@ static int __init acq_probe(struct platform_device *dev)
 	return ret;
 }
 
-static int acq_remove(struct platform_device *dev)
+static void acq_remove(struct platform_device *dev)
 {
 	misc_deregister(&acq_miscdev);
 	release_region(wdt_start, 1);
 	if (wdt_stop != wdt_start)
 		release_region(wdt_stop, 1);
-
-	return 0;
 }
 
 static void acq_shutdown(struct platform_device *dev)
@@ -288,7 +286,7 @@ static void acq_shutdown(struct platform_device *dev)
 }
 
 static struct platform_driver acquirewdt_driver = {
-	.remove		= acq_remove,
+	.remove_new	= acq_remove,
 	.shutdown	= acq_shutdown,
 	.driver		= {
 		.name	= DRV_NAME,
-- 
2.39.1


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

* [PATCH 03/34] watchdog: advantechwdt: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
  2023-03-03 21:36 ` [PATCH 01/34] watchdog: s3c2410: Don't skip cleanup in remove's error path Uwe Kleine-König
  2023-03-03 21:36 ` [PATCH 02/34] watchdog: acquirewdt: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 17:02   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 04/34] watchdog: ar7: " Uwe Kleine-König
                   ` (32 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/advantechwdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/advantechwdt.c b/drivers/watchdog/advantechwdt.c
index 554fe85da50e..7a0acbc3e4dd 100644
--- a/drivers/watchdog/advantechwdt.c
+++ b/drivers/watchdog/advantechwdt.c
@@ -279,14 +279,12 @@ static int __init advwdt_probe(struct platform_device *dev)
 	goto out;
 }
 
-static int advwdt_remove(struct platform_device *dev)
+static void advwdt_remove(struct platform_device *dev)
 {
 	misc_deregister(&advwdt_miscdev);
 	release_region(wdt_start, 1);
 	if (wdt_stop != wdt_start)
 		release_region(wdt_stop, 1);
-
-	return 0;
 }
 
 static void advwdt_shutdown(struct platform_device *dev)
@@ -296,7 +294,7 @@ static void advwdt_shutdown(struct platform_device *dev)
 }
 
 static struct platform_driver advwdt_driver = {
-	.remove		= advwdt_remove,
+	.remove_new	= advwdt_remove,
 	.shutdown	= advwdt_shutdown,
 	.driver		= {
 		.name	= DRV_NAME,
-- 
2.39.1


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

* [PATCH 04/34] watchdog: ar7: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (2 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 03/34] watchdog: advantechwdt: " Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 17:02   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 05/34] watchdog: at91rm9200: " Uwe Kleine-König
                   ` (31 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/ar7_wdt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c
index 743e171d97a3..cdcaeb0961ac 100644
--- a/drivers/watchdog/ar7_wdt.c
+++ b/drivers/watchdog/ar7_wdt.c
@@ -290,12 +290,11 @@ static int ar7_wdt_probe(struct platform_device *pdev)
 	return rc;
 }
 
-static int ar7_wdt_remove(struct platform_device *pdev)
+static void ar7_wdt_remove(struct platform_device *pdev)
 {
 	misc_deregister(&ar7_wdt_miscdev);
 	clk_put(vbus_clk);
 	vbus_clk = NULL;
-	return 0;
 }
 
 static void ar7_wdt_shutdown(struct platform_device *pdev)
@@ -306,7 +305,7 @@ static void ar7_wdt_shutdown(struct platform_device *pdev)
 
 static struct platform_driver ar7_wdt_driver = {
 	.probe = ar7_wdt_probe,
-	.remove = ar7_wdt_remove,
+	.remove_new = ar7_wdt_remove,
 	.shutdown = ar7_wdt_shutdown,
 	.driver = {
 		.name = "ar7_wdt",
-- 
2.39.1


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

* [PATCH 05/34] watchdog: at91rm9200: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (3 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 04/34] watchdog: ar7: " Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 17:02   ` Guenter Roeck
  2023-03-06 11:55   ` Claudiu.Beznea
  2023-03-03 21:36 ` [PATCH 06/34] watchdog: ath79: " Uwe Kleine-König
                   ` (30 subsequent siblings)
  35 siblings, 2 replies; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Nicolas Ferre,
	Alexandre Belloni, Claudiu Beznea
  Cc: linux-watchdog, 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/watchdog/at91rm9200_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c
index d57409c1a4d1..d20ec27ba354 100644
--- a/drivers/watchdog/at91rm9200_wdt.c
+++ b/drivers/watchdog/at91rm9200_wdt.c
@@ -258,7 +258,7 @@ static int at91wdt_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int at91wdt_remove(struct platform_device *pdev)
+static void at91wdt_remove(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	int res;
@@ -269,8 +269,6 @@ static int at91wdt_remove(struct platform_device *pdev)
 
 	misc_deregister(&at91wdt_miscdev);
 	at91wdt_miscdev.parent = NULL;
-
-	return 0;
 }
 
 static void at91wdt_shutdown(struct platform_device *pdev)
@@ -299,7 +297,7 @@ MODULE_DEVICE_TABLE(of, at91_wdt_dt_ids);
 
 static struct platform_driver at91wdt_driver = {
 	.probe		= at91wdt_probe,
-	.remove		= at91wdt_remove,
+	.remove_new	= at91wdt_remove,
 	.shutdown	= at91wdt_shutdown,
 	.suspend	= pm_ptr(at91wdt_suspend),
 	.resume		= pm_ptr(at91wdt_resume),
-- 
2.39.1


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

* [PATCH 06/34] watchdog: ath79: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (4 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 05/34] watchdog: at91rm9200: " Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 17:02   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 07/34] watchdog: bcm2835: " Uwe Kleine-König
                   ` (29 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/ath79_wdt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/ath79_wdt.c b/drivers/watchdog/ath79_wdt.c
index 0f18f06a21b6..b7b705060438 100644
--- a/drivers/watchdog/ath79_wdt.c
+++ b/drivers/watchdog/ath79_wdt.c
@@ -296,11 +296,10 @@ static int ath79_wdt_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int ath79_wdt_remove(struct platform_device *pdev)
+static void ath79_wdt_remove(struct platform_device *pdev)
 {
 	misc_deregister(&ath79_wdt_miscdev);
 	clk_disable_unprepare(wdt_clk);
-	return 0;
 }
 
 static void ath79_wdt_shutdown(struct platform_device *pdev)
@@ -318,7 +317,7 @@ MODULE_DEVICE_TABLE(of, ath79_wdt_match);
 
 static struct platform_driver ath79_wdt_driver = {
 	.probe		= ath79_wdt_probe,
-	.remove		= ath79_wdt_remove,
+	.remove_new	= ath79_wdt_remove,
 	.shutdown	= ath79_wdt_shutdown,
 	.driver		= {
 		.name	= DRIVER_NAME,
-- 
2.39.1


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

* [PATCH 07/34] watchdog: bcm2835: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (5 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 06/34] watchdog: ath79: " Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-03 21:38   ` Florian Fainelli
  2023-03-04 17:04   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 08/34] watchdog: bcm47xx: " Uwe Kleine-König
                   ` (28 subsequent siblings)
  35 siblings, 2 replies; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Florian Fainelli, Ray Jui,
	Scott Branden
  Cc: Broadcom internal kernel review list, linux-watchdog,
	linux-rpi-kernel, 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/watchdog/bcm2835_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c
index 94907176a0e4..7a855289ff5e 100644
--- a/drivers/watchdog/bcm2835_wdt.c
+++ b/drivers/watchdog/bcm2835_wdt.c
@@ -218,17 +218,15 @@ static int bcm2835_wdt_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int bcm2835_wdt_remove(struct platform_device *pdev)
+static void bcm2835_wdt_remove(struct platform_device *pdev)
 {
 	if (pm_power_off == bcm2835_power_off)
 		pm_power_off = NULL;
-
-	return 0;
 }
 
 static struct platform_driver bcm2835_wdt_driver = {
 	.probe		= bcm2835_wdt_probe,
-	.remove		= bcm2835_wdt_remove,
+	.remove_new	= bcm2835_wdt_remove,
 	.driver = {
 		.name =		"bcm2835-wdt",
 	},
-- 
2.39.1


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

* [PATCH 08/34] watchdog: bcm47xx: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (6 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 07/34] watchdog: bcm2835: " Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 17:01   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 09/34] watchdog: bcm_kona: " Uwe Kleine-König
                   ` (27 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/bcm47xx_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/bcm47xx_wdt.c b/drivers/watchdog/bcm47xx_wdt.c
index 05425c1dfd4c..841ca1839f7f 100644
--- a/drivers/watchdog/bcm47xx_wdt.c
+++ b/drivers/watchdog/bcm47xx_wdt.c
@@ -218,13 +218,11 @@ static int bcm47xx_wdt_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int bcm47xx_wdt_remove(struct platform_device *pdev)
+static void bcm47xx_wdt_remove(struct platform_device *pdev)
 {
 	struct bcm47xx_wdt *wdt = dev_get_platdata(&pdev->dev);
 
 	watchdog_unregister_device(&wdt->wdd);
-
-	return 0;
 }
 
 static struct platform_driver bcm47xx_wdt_driver = {
@@ -232,7 +230,7 @@ static struct platform_driver bcm47xx_wdt_driver = {
 		.name	= "bcm47xx-wdt",
 	},
 	.probe		= bcm47xx_wdt_probe,
-	.remove		= bcm47xx_wdt_remove,
+	.remove_new	= bcm47xx_wdt_remove,
 };
 
 module_platform_driver(bcm47xx_wdt_driver);
-- 
2.39.1


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

* [PATCH 09/34] watchdog: bcm_kona: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (7 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 08/34] watchdog: bcm47xx: " Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-03 21:39   ` Florian Fainelli
  2023-03-04 17:05   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 10/34] watchdog: cpwd: " Uwe Kleine-König
                   ` (26 subsequent siblings)
  35 siblings, 2 replies; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Florian Fainelli, Ray Jui,
	Scott Branden
  Cc: Broadcom internal kernel review list, linux-watchdog, 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/watchdog/bcm_kona_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c
index 8237c4e9c2a0..49e12d47b073 100644
--- a/drivers/watchdog/bcm_kona_wdt.c
+++ b/drivers/watchdog/bcm_kona_wdt.c
@@ -310,12 +310,10 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int bcm_kona_wdt_remove(struct platform_device *pdev)
+static void bcm_kona_wdt_remove(struct platform_device *pdev)
 {
 	bcm_kona_wdt_debug_exit(pdev);
 	dev_dbg(&pdev->dev, "Watchdog driver disabled");
-
-	return 0;
 }
 
 static const struct of_device_id bcm_kona_wdt_of_match[] = {
@@ -330,7 +328,7 @@ static struct platform_driver bcm_kona_wdt_driver = {
 			.of_match_table = bcm_kona_wdt_of_match,
 		  },
 	.probe = bcm_kona_wdt_probe,
-	.remove = bcm_kona_wdt_remove,
+	.remove_new = bcm_kona_wdt_remove,
 };
 
 module_platform_driver(bcm_kona_wdt_driver);
-- 
2.39.1


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

* [PATCH 10/34] watchdog: cpwd: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (8 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 09/34] watchdog: bcm_kona: " Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 17:05   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 11/34] watchdog: dw: " Uwe Kleine-König
                   ` (25 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/cpwd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c
index 1eafe0b4d71c..47250f9b68c7 100644
--- a/drivers/watchdog/cpwd.c
+++ b/drivers/watchdog/cpwd.c
@@ -614,7 +614,7 @@ static int cpwd_probe(struct platform_device *op)
 	return err;
 }
 
-static int cpwd_remove(struct platform_device *op)
+static void cpwd_remove(struct platform_device *op)
 {
 	struct cpwd *p = platform_get_drvdata(op);
 	int i;
@@ -638,8 +638,6 @@ static int cpwd_remove(struct platform_device *op)
 	of_iounmap(&op->resource[0], p->regs, 4 * WD_TIMER_REGSZ);
 
 	cpwd_device = NULL;
-
-	return 0;
 }
 
 static const struct of_device_id cpwd_match[] = {
@@ -656,7 +654,7 @@ static struct platform_driver cpwd_driver = {
 		.of_match_table = cpwd_match,
 	},
 	.probe		= cpwd_probe,
-	.remove		= cpwd_remove,
+	.remove_new	= cpwd_remove,
 };
 
 module_platform_driver(cpwd_driver);
-- 
2.39.1


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

* [PATCH 11/34] watchdog: dw: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (9 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 10/34] watchdog: cpwd: " Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 17:06   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 12/34] watchdog: gef: " Uwe Kleine-König
                   ` (24 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/dw_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
index 462f15bd5ffa..6f88bd81f8a1 100644
--- a/drivers/watchdog/dw_wdt.c
+++ b/drivers/watchdog/dw_wdt.c
@@ -681,7 +681,7 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int dw_wdt_drv_remove(struct platform_device *pdev)
+static void dw_wdt_drv_remove(struct platform_device *pdev)
 {
 	struct dw_wdt *dw_wdt = platform_get_drvdata(pdev);
 
@@ -691,8 +691,6 @@ static int dw_wdt_drv_remove(struct platform_device *pdev)
 	reset_control_assert(dw_wdt->rst);
 	clk_disable_unprepare(dw_wdt->pclk);
 	clk_disable_unprepare(dw_wdt->clk);
-
-	return 0;
 }
 
 #ifdef CONFIG_OF
@@ -705,7 +703,7 @@ MODULE_DEVICE_TABLE(of, dw_wdt_of_match);
 
 static struct platform_driver dw_wdt_driver = {
 	.probe		= dw_wdt_drv_probe,
-	.remove		= dw_wdt_drv_remove,
+	.remove_new	= dw_wdt_drv_remove,
 	.driver		= {
 		.name	= "dw_wdt",
 		.of_match_table = of_match_ptr(dw_wdt_of_match),
-- 
2.39.1


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

* [PATCH 12/34] watchdog: gef: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (10 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 11/34] watchdog: dw: " Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 17:06   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 13/34] watchdog: geodewdt: " Uwe Kleine-König
                   ` (23 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/gef_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c
index df5406aa7d25..97afc907f659 100644
--- a/drivers/watchdog/gef_wdt.c
+++ b/drivers/watchdog/gef_wdt.c
@@ -283,15 +283,13 @@ static int gef_wdt_probe(struct platform_device *dev)
 	return misc_register(&gef_wdt_miscdev);
 }
 
-static int gef_wdt_remove(struct platform_device *dev)
+static void gef_wdt_remove(struct platform_device *dev)
 {
 	misc_deregister(&gef_wdt_miscdev);
 
 	gef_wdt_handler_disable();
 
 	iounmap(gef_wdt_regs);
-
-	return 0;
 }
 
 static const struct of_device_id gef_wdt_ids[] = {
@@ -308,7 +306,7 @@ static struct platform_driver gef_wdt_driver = {
 		.of_match_table = gef_wdt_ids,
 	},
 	.probe		= gef_wdt_probe,
-	.remove		= gef_wdt_remove,
+	.remove_new	= gef_wdt_remove,
 };
 
 static int __init gef_wdt_init(void)
-- 
2.39.1


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

* [PATCH 13/34] watchdog: geodewdt: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (11 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 12/34] watchdog: gef: " Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 17:07   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 14/34] watchdog: ib700wdt: " Uwe Kleine-König
                   ` (22 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/geodewdt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c
index 0b699c783d57..5186c37ad451 100644
--- a/drivers/watchdog/geodewdt.c
+++ b/drivers/watchdog/geodewdt.c
@@ -238,10 +238,9 @@ static int __init geodewdt_probe(struct platform_device *dev)
 	return ret;
 }
 
-static int geodewdt_remove(struct platform_device *dev)
+static void geodewdt_remove(struct platform_device *dev)
 {
 	misc_deregister(&geodewdt_miscdev);
-	return 0;
 }
 
 static void geodewdt_shutdown(struct platform_device *dev)
@@ -250,7 +249,7 @@ static void geodewdt_shutdown(struct platform_device *dev)
 }
 
 static struct platform_driver geodewdt_driver = {
-	.remove		= geodewdt_remove,
+	.remove_new	= geodewdt_remove,
 	.shutdown	= geodewdt_shutdown,
 	.driver		= {
 		.name	= DRV_NAME,
-- 
2.39.1


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

* [PATCH 14/34] watchdog: ib700wdt: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (12 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 13/34] watchdog: geodewdt: " Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 17:07   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 15/34] watchdog: ie6xx: " Uwe Kleine-König
                   ` (21 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/ib700wdt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c
index a0ddedc362fc..39ea97009abd 100644
--- a/drivers/watchdog/ib700wdt.c
+++ b/drivers/watchdog/ib700wdt.c
@@ -316,14 +316,13 @@ static int __init ibwdt_probe(struct platform_device *dev)
 	return res;
 }
 
-static int ibwdt_remove(struct platform_device *dev)
+static void ibwdt_remove(struct platform_device *dev)
 {
 	misc_deregister(&ibwdt_miscdev);
 	release_region(WDT_START, 1);
 #if WDT_START != WDT_STOP
 	release_region(WDT_STOP, 1);
 #endif
-	return 0;
 }
 
 static void ibwdt_shutdown(struct platform_device *dev)
@@ -333,7 +332,7 @@ static void ibwdt_shutdown(struct platform_device *dev)
 }
 
 static struct platform_driver ibwdt_driver = {
-	.remove		= ibwdt_remove,
+	.remove_new	= ibwdt_remove,
 	.shutdown	= ibwdt_shutdown,
 	.driver		= {
 		.name	= DRV_NAME,
-- 
2.39.1


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

* [PATCH 15/34] watchdog: ie6xx: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (13 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 14/34] watchdog: ib700wdt: " Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 17:07   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 16/34] watchdog: lpc18xx: " Uwe Kleine-König
                   ` (20 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/ie6xx_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/ie6xx_wdt.c b/drivers/watchdog/ie6xx_wdt.c
index 8f28993fab8b..e5cbb409df25 100644
--- a/drivers/watchdog/ie6xx_wdt.c
+++ b/drivers/watchdog/ie6xx_wdt.c
@@ -266,7 +266,7 @@ static int ie6xx_wdt_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int ie6xx_wdt_remove(struct platform_device *pdev)
+static void ie6xx_wdt_remove(struct platform_device *pdev)
 {
 	struct resource *res;
 
@@ -276,13 +276,11 @@ static int ie6xx_wdt_remove(struct platform_device *pdev)
 	ie6xx_wdt_debugfs_exit();
 	release_region(res->start, resource_size(res));
 	ie6xx_wdt_data.sch_wdtba = 0;
-
-	return 0;
 }
 
 static struct platform_driver ie6xx_wdt_driver = {
 	.probe		= ie6xx_wdt_probe,
-	.remove		= ie6xx_wdt_remove,
+	.remove_new	= ie6xx_wdt_remove,
 	.driver		= {
 		.name	= DRIVER_NAME,
 	},
-- 
2.39.1


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

* [PATCH 16/34] watchdog: lpc18xx: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (14 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 15/34] watchdog: ie6xx: " Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 17:08   ` Guenter Roeck
  2023-03-03 21:36 ` [PATCH 17/34] watchdog: mtx-1: " Uwe Kleine-König
                   ` (19 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Vladimir Zapolskiy
  Cc: linux-watchdog, 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/watchdog/lpc18xx_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/lpc18xx_wdt.c b/drivers/watchdog/lpc18xx_wdt.c
index 1b9b5f21a0df..19535f4a2fd2 100644
--- a/drivers/watchdog/lpc18xx_wdt.c
+++ b/drivers/watchdog/lpc18xx_wdt.c
@@ -261,14 +261,12 @@ static int lpc18xx_wdt_probe(struct platform_device *pdev)
 	return devm_watchdog_register_device(dev, &lpc18xx_wdt->wdt_dev);
 }
 
-static int lpc18xx_wdt_remove(struct platform_device *pdev)
+static void lpc18xx_wdt_remove(struct platform_device *pdev)
 {
 	struct lpc18xx_wdt_dev *lpc18xx_wdt = platform_get_drvdata(pdev);
 
 	dev_warn(&pdev->dev, "I quit now, hardware will probably reboot!\n");
 	del_timer_sync(&lpc18xx_wdt->timer);
-
-	return 0;
 }
 
 static const struct of_device_id lpc18xx_wdt_match[] = {
@@ -283,7 +281,7 @@ static struct platform_driver lpc18xx_wdt_driver = {
 		.of_match_table	= lpc18xx_wdt_match,
 	},
 	.probe = lpc18xx_wdt_probe,
-	.remove = lpc18xx_wdt_remove,
+	.remove_new = lpc18xx_wdt_remove,
 };
 module_platform_driver(lpc18xx_wdt_driver);
 
-- 
2.39.1


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

* [PATCH 17/34] watchdog: mtx-1: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (15 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 16/34] watchdog: lpc18xx: " Uwe Kleine-König
@ 2023-03-03 21:36 ` Uwe Kleine-König
  2023-03-04 17:09   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 18/34] watchdog: nic7018: " Uwe Kleine-König
                   ` (18 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/mtx-1_wdt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c
index ea1bbf5ee528..152e41ecbb14 100644
--- a/drivers/watchdog/mtx-1_wdt.c
+++ b/drivers/watchdog/mtx-1_wdt.c
@@ -221,7 +221,7 @@ static int mtx1_wdt_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int mtx1_wdt_remove(struct platform_device *pdev)
+static void mtx1_wdt_remove(struct platform_device *pdev)
 {
 	/* FIXME: do we need to lock this test ? */
 	if (mtx1_wdt_device.queue) {
@@ -230,12 +230,11 @@ static int mtx1_wdt_remove(struct platform_device *pdev)
 	}
 
 	misc_deregister(&mtx1_wdt_misc);
-	return 0;
 }
 
 static struct platform_driver mtx1_wdt_driver = {
 	.probe = mtx1_wdt_probe,
-	.remove = mtx1_wdt_remove,
+	.remove_new = mtx1_wdt_remove,
 	.driver.name = "mtx1-wdt",
 	.driver.owner = THIS_MODULE,
 };
-- 
2.39.1


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

* [PATCH 18/34] watchdog: nic7018: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (16 preceding siblings ...)
  2023-03-03 21:36 ` [PATCH 17/34] watchdog: mtx-1: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:09   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 19/34] watchdog: nv_tco: " Uwe Kleine-König
                   ` (17 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/nic7018_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/nic7018_wdt.c b/drivers/watchdog/nic7018_wdt.c
index 2a46cc662943..c3f0a4926667 100644
--- a/drivers/watchdog/nic7018_wdt.c
+++ b/drivers/watchdog/nic7018_wdt.c
@@ -218,7 +218,7 @@ static int nic7018_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int nic7018_remove(struct platform_device *pdev)
+static void nic7018_remove(struct platform_device *pdev)
 {
 	struct nic7018_wdt *wdt = platform_get_drvdata(pdev);
 
@@ -226,8 +226,6 @@ static int nic7018_remove(struct platform_device *pdev)
 
 	/* Lock WDT register */
 	outb(LOCK, wdt->io_base + WDT_REG_LOCK);
-
-	return 0;
 }
 
 static const struct acpi_device_id nic7018_device_ids[] = {
@@ -238,7 +236,7 @@ MODULE_DEVICE_TABLE(acpi, nic7018_device_ids);
 
 static struct platform_driver watchdog_driver = {
 	.probe = nic7018_probe,
-	.remove = nic7018_remove,
+	.remove_new = nic7018_remove,
 	.driver = {
 		.name = KBUILD_MODNAME,
 		.acpi_match_table = ACPI_PTR(nic7018_device_ids),
-- 
2.39.1


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

* [PATCH 19/34] watchdog: nv_tco: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (17 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 18/34] watchdog: nic7018: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:09   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 20/34] watchdog: omap: " Uwe Kleine-König
                   ` (16 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/nv_tco.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/nv_tco.c b/drivers/watchdog/nv_tco.c
index f6902a337422..ac4a9c16341d 100644
--- a/drivers/watchdog/nv_tco.c
+++ b/drivers/watchdog/nv_tco.c
@@ -446,12 +446,10 @@ static void nv_tco_cleanup(void)
 	release_region(tcobase, 0x10);
 }
 
-static int nv_tco_remove(struct platform_device *dev)
+static void nv_tco_remove(struct platform_device *dev)
 {
 	if (tcobase)
 		nv_tco_cleanup();
-
-	return 0;
 }
 
 static void nv_tco_shutdown(struct platform_device *dev)
@@ -469,7 +467,7 @@ static void nv_tco_shutdown(struct platform_device *dev)
 
 static struct platform_driver nv_tco_driver = {
 	.probe		= nv_tco_init,
-	.remove		= nv_tco_remove,
+	.remove_new	= nv_tco_remove,
 	.shutdown	= nv_tco_shutdown,
 	.driver		= {
 		.name	= TCO_MODULE_NAME,
-- 
2.39.1


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

* [PATCH 20/34] watchdog: omap: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (18 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 19/34] watchdog: nv_tco: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:09   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 21/34] watchdog: orion: " Uwe Kleine-König
                   ` (15 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/omap_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index e75aa86f63cb..a7a12f2fe9de 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -306,14 +306,12 @@ static void omap_wdt_shutdown(struct platform_device *pdev)
 	mutex_unlock(&wdev->lock);
 }
 
-static int omap_wdt_remove(struct platform_device *pdev)
+static void omap_wdt_remove(struct platform_device *pdev)
 {
 	struct omap_wdt_dev *wdev = platform_get_drvdata(pdev);
 
 	pm_runtime_disable(wdev->dev);
 	watchdog_unregister_device(&wdev->wdog);
-
-	return 0;
 }
 
 /* REVISIT ... not clear this is the best way to handle system suspend; and
@@ -359,7 +357,7 @@ MODULE_DEVICE_TABLE(of, omap_wdt_of_match);
 
 static struct platform_driver omap_wdt_driver = {
 	.probe		= omap_wdt_probe,
-	.remove		= omap_wdt_remove,
+	.remove_new	= omap_wdt_remove,
 	.shutdown	= omap_wdt_shutdown,
 	.suspend	= pm_ptr(omap_wdt_suspend),
 	.resume		= pm_ptr(omap_wdt_resume),
-- 
2.39.1


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

* [PATCH 21/34] watchdog: orion: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (19 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 20/34] watchdog: omap: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:10   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 22/34] watchdog: rc32434: " Uwe Kleine-König
                   ` (14 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/orion_wdt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index e25e6bf4647f..5ec2dd8fd5fa 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -649,7 +649,7 @@ static int orion_wdt_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int orion_wdt_remove(struct platform_device *pdev)
+static void orion_wdt_remove(struct platform_device *pdev)
 {
 	struct watchdog_device *wdt_dev = platform_get_drvdata(pdev);
 	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
@@ -657,7 +657,6 @@ static int orion_wdt_remove(struct platform_device *pdev)
 	watchdog_unregister_device(wdt_dev);
 	clk_disable_unprepare(dev->clk);
 	clk_put(dev->clk);
-	return 0;
 }
 
 static void orion_wdt_shutdown(struct platform_device *pdev)
@@ -668,7 +667,7 @@ static void orion_wdt_shutdown(struct platform_device *pdev)
 
 static struct platform_driver orion_wdt_driver = {
 	.probe		= orion_wdt_probe,
-	.remove		= orion_wdt_remove,
+	.remove_new	= orion_wdt_remove,
 	.shutdown	= orion_wdt_shutdown,
 	.driver		= {
 		.name	= "orion_wdt",
-- 
2.39.1


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

* [PATCH 22/34] watchdog: rc32434: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (20 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 21/34] watchdog: orion: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:10   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 23/34] watchdog: rdc321x: " Uwe Kleine-König
                   ` (13 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/rc32434_wdt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c
index e74802f3a32e..417f9b75679c 100644
--- a/drivers/watchdog/rc32434_wdt.c
+++ b/drivers/watchdog/rc32434_wdt.c
@@ -298,10 +298,9 @@ static int rc32434_wdt_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int rc32434_wdt_remove(struct platform_device *pdev)
+static void rc32434_wdt_remove(struct platform_device *pdev)
 {
 	misc_deregister(&rc32434_wdt_miscdev);
-	return 0;
 }
 
 static void rc32434_wdt_shutdown(struct platform_device *pdev)
@@ -311,7 +310,7 @@ static void rc32434_wdt_shutdown(struct platform_device *pdev)
 
 static struct platform_driver rc32434_wdt_driver = {
 	.probe		= rc32434_wdt_probe,
-	.remove		= rc32434_wdt_remove,
+	.remove_new	= rc32434_wdt_remove,
 	.shutdown	= rc32434_wdt_shutdown,
 	.driver		= {
 			.name = "rc32434_wdt",
-- 
2.39.1


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

* [PATCH 23/34] watchdog: rdc321x: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (21 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 22/34] watchdog: rc32434: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:10   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 24/34] watchdog: renesas: " Uwe Kleine-König
                   ` (12 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/rdc321x_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c
index f0c94ea51c3e..6176f4343fc5 100644
--- a/drivers/watchdog/rdc321x_wdt.c
+++ b/drivers/watchdog/rdc321x_wdt.c
@@ -257,7 +257,7 @@ static int rdc321x_wdt_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int rdc321x_wdt_remove(struct platform_device *pdev)
+static void rdc321x_wdt_remove(struct platform_device *pdev)
 {
 	if (rdc321x_wdt_device.queue) {
 		rdc321x_wdt_device.queue = 0;
@@ -265,13 +265,11 @@ static int rdc321x_wdt_remove(struct platform_device *pdev)
 	}
 
 	misc_deregister(&rdc321x_wdt_misc);
-
-	return 0;
 }
 
 static struct platform_driver rdc321x_wdt_driver = {
 	.probe = rdc321x_wdt_probe,
-	.remove = rdc321x_wdt_remove,
+	.remove_new = rdc321x_wdt_remove,
 	.driver = {
 		.name = "rdc321x-wdt",
 	},
-- 
2.39.1


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

* [PATCH 24/34] watchdog: renesas: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (22 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 23/34] watchdog: rdc321x: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:10   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 25/34] watchdog: riowd: " Uwe Kleine-König
                   ` (11 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/renesas_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c
index 41d58ea5eb2f..12c41d6e5cd6 100644
--- a/drivers/watchdog/renesas_wdt.c
+++ b/drivers/watchdog/renesas_wdt.c
@@ -292,14 +292,12 @@ static int rwdt_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int rwdt_remove(struct platform_device *pdev)
+static void rwdt_remove(struct platform_device *pdev)
 {
 	struct rwdt_priv *priv = platform_get_drvdata(pdev);
 
 	watchdog_unregister_device(&priv->wdev);
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 static int __maybe_unused rwdt_suspend(struct device *dev)
@@ -339,7 +337,7 @@ static struct platform_driver rwdt_driver = {
 		.pm = &rwdt_pm_ops,
 	},
 	.probe = rwdt_probe,
-	.remove = rwdt_remove,
+	.remove_new = rwdt_remove,
 };
 module_platform_driver(rwdt_driver);
 
-- 
2.39.1


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

* [PATCH 25/34] watchdog: riowd: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (23 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 24/34] watchdog: renesas: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:10   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 26/34] watchdog: rn5t618: " Uwe Kleine-König
                   ` (10 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/riowd.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c
index 747e346ed06c..c04b383e1712 100644
--- a/drivers/watchdog/riowd.c
+++ b/drivers/watchdog/riowd.c
@@ -217,14 +217,12 @@ static int riowd_probe(struct platform_device *op)
 	return err;
 }
 
-static int riowd_remove(struct platform_device *op)
+static void riowd_remove(struct platform_device *op)
 {
 	struct riowd *p = platform_get_drvdata(op);
 
 	misc_deregister(&riowd_miscdev);
 	of_iounmap(&op->resource[0], p->regs, 2);
-
-	return 0;
 }
 
 static const struct of_device_id riowd_match[] = {
@@ -241,7 +239,7 @@ static struct platform_driver riowd_driver = {
 		.of_match_table = riowd_match,
 	},
 	.probe		= riowd_probe,
-	.remove		= riowd_remove,
+	.remove_new	= riowd_remove,
 };
 
 module_platform_driver(riowd_driver);
-- 
2.39.1


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

* [PATCH 26/34] watchdog: rn5t618: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (24 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 25/34] watchdog: riowd: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:12   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 27/34] watchdog: rti: " Uwe Kleine-König
                   ` (9 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/rn5t618_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/rn5t618_wdt.c b/drivers/watchdog/rn5t618_wdt.c
index 40d8ebd8c0ac..b0da5cc8ccdf 100644
--- a/drivers/watchdog/rn5t618_wdt.c
+++ b/drivers/watchdog/rn5t618_wdt.c
@@ -181,18 +181,16 @@ static int rn5t618_wdt_probe(struct platform_device *pdev)
 	return watchdog_register_device(&wdt->wdt_dev);
 }
 
-static int rn5t618_wdt_remove(struct platform_device *pdev)
+static void rn5t618_wdt_remove(struct platform_device *pdev)
 {
 	struct rn5t618_wdt *wdt = platform_get_drvdata(pdev);
 
 	watchdog_unregister_device(&wdt->wdt_dev);
-
-	return 0;
 }
 
 static struct platform_driver rn5t618_wdt_driver = {
 	.probe = rn5t618_wdt_probe,
-	.remove = rn5t618_wdt_remove,
+	.remove_new = rn5t618_wdt_remove,
 	.driver = {
 		.name	= DRIVER_NAME,
 	},
-- 
2.39.1


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

* [PATCH 27/34] watchdog: rti: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (25 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 26/34] watchdog: rn5t618: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:12   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 28/34] watchdog: s3c2410: " Uwe Kleine-König
                   ` (8 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/rti_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
index 6e9253761fc1..ce8f18e93aa9 100644
--- a/drivers/watchdog/rti_wdt.c
+++ b/drivers/watchdog/rti_wdt.c
@@ -304,15 +304,13 @@ static int rti_wdt_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int rti_wdt_remove(struct platform_device *pdev)
+static void rti_wdt_remove(struct platform_device *pdev)
 {
 	struct rti_wdt_device *wdt = platform_get_drvdata(pdev);
 
 	watchdog_unregister_device(&wdt->wdd);
 	pm_runtime_put(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 static const struct of_device_id rti_wdt_of_match[] = {
@@ -327,7 +325,7 @@ static struct platform_driver rti_wdt_driver = {
 		.of_match_table = rti_wdt_of_match,
 	},
 	.probe = rti_wdt_probe,
-	.remove = rti_wdt_remove,
+	.remove_new = rti_wdt_remove,
 };
 
 module_platform_driver(rti_wdt_driver);
-- 
2.39.1


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

* [PATCH 28/34] watchdog: s3c2410: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (26 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 27/34] watchdog: rti: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:12   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 29/34] watchdog: sa1100: " Uwe Kleine-König
                   ` (7 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Wim Van Sebroeck, Guenter Roeck
  Cc: Alim Akhtar, linux-arm-kernel, linux-samsung-soc, linux-watchdog, 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/watchdog/s3c2410_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index cf104a844a43..d1f408913843 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -775,7 +775,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int s3c2410wdt_remove(struct platform_device *dev)
+static void s3c2410wdt_remove(struct platform_device *dev)
 {
 	int ret;
 	struct s3c2410_wdt *wdt = platform_get_drvdata(dev);
@@ -789,8 +789,6 @@ static int s3c2410wdt_remove(struct platform_device *dev)
 
 	clk_disable_unprepare(wdt->src_clk);
 	clk_disable_unprepare(wdt->bus_clk);
-
-	return 0;
 }
 
 static void s3c2410wdt_shutdown(struct platform_device *dev)
@@ -845,7 +843,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(s3c2410wdt_pm_ops,
 
 static struct platform_driver s3c2410wdt_driver = {
 	.probe		= s3c2410wdt_probe,
-	.remove		= s3c2410wdt_remove,
+	.remove_new	= s3c2410wdt_remove,
 	.shutdown	= s3c2410wdt_shutdown,
 	.id_table	= s3c2410_wdt_ids,
 	.driver		= {
-- 
2.39.1


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

* [PATCH 29/34] watchdog: sa1100: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (27 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 28/34] watchdog: s3c2410: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:13   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 30/34] watchdog: sch311x: " Uwe Kleine-König
                   ` (6 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/sa1100_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c
index 82ac5d19f519..5d2df008b92a 100644
--- a/drivers/watchdog/sa1100_wdt.c
+++ b/drivers/watchdog/sa1100_wdt.c
@@ -229,19 +229,17 @@ static int sa1100dog_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int sa1100dog_remove(struct platform_device *pdev)
+static void sa1100dog_remove(struct platform_device *pdev)
 {
 	misc_deregister(&sa1100dog_miscdev);
 	clk_disable_unprepare(clk);
 	clk_put(clk);
-
-	return 0;
 }
 
 static struct platform_driver sa1100dog_driver = {
 	.driver.name = "sa1100_wdt",
 	.probe	  = sa1100dog_probe,
-	.remove	  = sa1100dog_remove,
+	.remove_new	  = sa1100dog_remove,
 };
 module_platform_driver(sa1100dog_driver);
 
-- 
2.39.1


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

* [PATCH 30/34] watchdog: sch311x: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (28 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 29/34] watchdog: sa1100: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:13   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 31/34] watchdog: shwdt: " Uwe Kleine-König
                   ` (5 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/sch311x_wdt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/sch311x_wdt.c b/drivers/watchdog/sch311x_wdt.c
index d8b77fe10eba..409d49880170 100644
--- a/drivers/watchdog/sch311x_wdt.c
+++ b/drivers/watchdog/sch311x_wdt.c
@@ -425,7 +425,7 @@ static int sch311x_wdt_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int sch311x_wdt_remove(struct platform_device *pdev)
+static void sch311x_wdt_remove(struct platform_device *pdev)
 {
 	/* Stop the timer before we leave */
 	if (!nowayout)
@@ -436,7 +436,6 @@ static int sch311x_wdt_remove(struct platform_device *pdev)
 	release_region(sch311x_wdt_data.runtime_reg + WDT_TIME_OUT, 4);
 	release_region(sch311x_wdt_data.runtime_reg + GP60, 1);
 	sch311x_wdt_data.runtime_reg = 0;
-	return 0;
 }
 
 static void sch311x_wdt_shutdown(struct platform_device *dev)
@@ -447,7 +446,7 @@ static void sch311x_wdt_shutdown(struct platform_device *dev)
 
 static struct platform_driver sch311x_wdt_driver = {
 	.probe		= sch311x_wdt_probe,
-	.remove		= sch311x_wdt_remove,
+	.remove_new	= sch311x_wdt_remove,
 	.shutdown	= sch311x_wdt_shutdown,
 	.driver		= {
 		.name = DRV_NAME,
-- 
2.39.1


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

* [PATCH 31/34] watchdog: shwdt: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (29 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 30/34] watchdog: sch311x: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:13   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 32/34] watchdog: st_lpc: " Uwe Kleine-König
                   ` (4 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: linux-watchdog, 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/watchdog/shwdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c
index f55533e0e045..10f1fba78ec2 100644
--- a/drivers/watchdog/shwdt.c
+++ b/drivers/watchdog/shwdt.c
@@ -279,13 +279,11 @@ static int sh_wdt_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int sh_wdt_remove(struct platform_device *pdev)
+static void sh_wdt_remove(struct platform_device *pdev)
 {
 	watchdog_unregister_device(&sh_wdt_dev);
 
 	pm_runtime_disable(&pdev->dev);
-
-	return 0;
 }
 
 static void sh_wdt_shutdown(struct platform_device *pdev)
@@ -299,7 +297,7 @@ static struct platform_driver sh_wdt_driver = {
 	},
 
 	.probe		= sh_wdt_probe,
-	.remove		= sh_wdt_remove,
+	.remove_new	= sh_wdt_remove,
 	.shutdown	= sh_wdt_shutdown,
 };
 
-- 
2.39.1


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

* [PATCH 32/34] watchdog: st_lpc: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (30 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 31/34] watchdog: shwdt: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:13   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 33/34] watchdog: stmp3xxx_rtc: " Uwe Kleine-König
                   ` (3 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Patrice Chotard, Wim Van Sebroeck, Guenter Roeck
  Cc: linux-arm-kernel, linux-watchdog, 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/watchdog/st_lpc_wdt.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/st_lpc_wdt.c b/drivers/watchdog/st_lpc_wdt.c
index 39abecdb9dd1..d2aa43c00221 100644
--- a/drivers/watchdog/st_lpc_wdt.c
+++ b/drivers/watchdog/st_lpc_wdt.c
@@ -239,13 +239,11 @@ static int st_wdog_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int st_wdog_remove(struct platform_device *pdev)
+static void st_wdog_remove(struct platform_device *pdev)
 {
 	struct st_wdog *st_wdog = watchdog_get_drvdata(&st_wdog_dev);
 
 	st_wdog_setup(st_wdog, false);
-
-	return 0;
 }
 
 static int st_wdog_suspend(struct device *dev)
@@ -295,7 +293,7 @@ static struct platform_driver st_wdog_driver = {
 		.of_match_table = st_wdog_match,
 	},
 	.probe = st_wdog_probe,
-	.remove = st_wdog_remove,
+	.remove_new = st_wdog_remove,
 };
 module_platform_driver(st_wdog_driver);
 
-- 
2.39.1


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

* [PATCH 33/34] watchdog: stmp3xxx_rtc: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (31 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 32/34] watchdog: st_lpc: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:14   ` Guenter Roeck
  2023-03-03 21:37 ` [PATCH 34/34] watchdog: wm8350: " Uwe Kleine-König
                   ` (2 subsequent siblings)
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Maxime Coquelin, Alexandre Torgue
  Cc: linux-watchdog, 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/watchdog/stmp3xxx_rtc_wdt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/stmp3xxx_rtc_wdt.c b/drivers/watchdog/stmp3xxx_rtc_wdt.c
index 7caf3aa71c6a..4b2caa9807ac 100644
--- a/drivers/watchdog/stmp3xxx_rtc_wdt.c
+++ b/drivers/watchdog/stmp3xxx_rtc_wdt.c
@@ -109,10 +109,9 @@ static int stmp3xxx_wdt_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int stmp3xxx_wdt_remove(struct platform_device *pdev)
+static void stmp3xxx_wdt_remove(struct platform_device *pdev)
 {
 	unregister_reboot_notifier(&wdt_notifier);
-	return 0;
 }
 
 static int __maybe_unused stmp3xxx_wdt_suspend(struct device *dev)
@@ -144,7 +143,7 @@ static struct platform_driver stmp3xxx_wdt_driver = {
 		.pm = &stmp3xxx_wdt_pm_ops,
 	},
 	.probe = stmp3xxx_wdt_probe,
-	.remove = stmp3xxx_wdt_remove,
+	.remove_new = stmp3xxx_wdt_remove,
 };
 module_platform_driver(stmp3xxx_wdt_driver);
 
-- 
2.39.1


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

* [PATCH 34/34] watchdog: wm8350: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (32 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 33/34] watchdog: stmp3xxx_rtc: " Uwe Kleine-König
@ 2023-03-03 21:37 ` Uwe Kleine-König
  2023-03-04 17:14   ` Guenter Roeck
  2023-03-06 17:05 ` [PATCH 00/34] watchdog: " Uwe Kleine-König
  2023-03-14  8:38 ` Naresh Kamboju
  35 siblings, 1 reply; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-03 21:37 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck; +Cc: patches, linux-watchdog, 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/watchdog/wm8350_wdt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/wm8350_wdt.c b/drivers/watchdog/wm8350_wdt.c
index 33c62d51f00a..febda195aed2 100644
--- a/drivers/watchdog/wm8350_wdt.c
+++ b/drivers/watchdog/wm8350_wdt.c
@@ -156,15 +156,14 @@ static int wm8350_wdt_probe(struct platform_device *pdev)
 	return watchdog_register_device(&wm8350_wdt);
 }
 
-static int wm8350_wdt_remove(struct platform_device *pdev)
+static void wm8350_wdt_remove(struct platform_device *pdev)
 {
 	watchdog_unregister_device(&wm8350_wdt);
-	return 0;
 }
 
 static struct platform_driver wm8350_wdt_driver = {
 	.probe = wm8350_wdt_probe,
-	.remove = wm8350_wdt_remove,
+	.remove_new = wm8350_wdt_remove,
 	.driver = {
 		.name = "wm8350-wdt",
 	},
-- 
2.39.1


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

* Re: [PATCH 07/34] watchdog: bcm2835: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 07/34] watchdog: bcm2835: " Uwe Kleine-König
@ 2023-03-03 21:38   ` Florian Fainelli
  2023-03-04 17:04   ` Guenter Roeck
  1 sibling, 0 replies; 74+ messages in thread
From: Florian Fainelli @ 2023-03-03 21:38 UTC (permalink / raw)
  To: Uwe Kleine-König, Wim Van Sebroeck, Guenter Roeck, Ray Jui,
	Scott Branden
  Cc: Broadcom internal kernel review list, linux-watchdog,
	linux-rpi-kernel, linux-arm-kernel, kernel

On 3/3/23 13:36, 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 (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: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian


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

* Re: [PATCH 09/34] watchdog: bcm_kona: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 09/34] watchdog: bcm_kona: " Uwe Kleine-König
@ 2023-03-03 21:39   ` Florian Fainelli
  2023-03-04 17:05   ` Guenter Roeck
  1 sibling, 0 replies; 74+ messages in thread
From: Florian Fainelli @ 2023-03-03 21:39 UTC (permalink / raw)
  To: Uwe Kleine-König, Wim Van Sebroeck, Guenter Roeck,
	Florian Fainelli, Ray Jui, Scott Branden
  Cc: Broadcom internal kernel review list, linux-watchdog, kernel

On 3/3/23 13:36, 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 (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: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian


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

* Re: [PATCH 01/34] watchdog: s3c2410: Don't skip cleanup in remove's error path
  2023-03-03 21:36 ` [PATCH 01/34] watchdog: s3c2410: Don't skip cleanup in remove's error path Uwe Kleine-König
@ 2023-03-04 16:58   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 16:58 UTC (permalink / raw)
  To: Uwe Kleine-König, Krzysztof Kozlowski, Wim Van Sebroeck,
	Doug Anderson, Leela Krishna Amudala
  Cc: Alim Akhtar, linux-arm-kernel, linux-samsung-soc, linux-watchdog, kernel

Hi Uwe,

On 3/3/23 13:36, Uwe Kleine-König wrote:
> Returning early in a platform driver's remove callback is wrong. In this
> case the watchdog device is never removed although it's parent is gone
> which likely can trigger a use-after-free in sysfs. Also the two used
> clocks will never be disabled.
> 
> Instead only warn if s3c2410wdt_enable() fails and cleanup. Note that
> returning 0 is the right thing to do then to suppress another warning
> message by the driver core.
> 
> Fixes: 4f1f653a68d6 ("watchdog: s3c2410_wdt: use syscon regmap interface to configure pmu register")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>   drivers/watchdog/s3c2410_wdt.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> index 200ba236a72e..cf104a844a43 100644
> --- a/drivers/watchdog/s3c2410_wdt.c
> +++ b/drivers/watchdog/s3c2410_wdt.c
> @@ -782,7 +782,8 @@ static int s3c2410wdt_remove(struct platform_device *dev)
>   
>   	ret = s3c2410wdt_enable(wdt, false);
>   	if (ret < 0)
> -		return ret;
> +		dev_warn(&dev->dev,
> +			 "Failed to disable watchdog (%pe)\n", ERR_PTR(ret));
>   
>   	watchdog_unregister_device(&wdt->wdt_device);
>   

I sent out two patches a minute ago which should make this patch
as well as the use of the remove_new callback unnecessary.

Guenter


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

* Re: [PATCH 08/34] watchdog: bcm47xx: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 08/34] watchdog: bcm47xx: " Uwe Kleine-König
@ 2023-03-04 17:01   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:01 UTC (permalink / raw)
  To: Uwe Kleine-König, Wim Van Sebroeck; +Cc: linux-watchdog, kernel

On 3/3/23 13:36, 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 (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/watchdog/bcm47xx_wdt.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/bcm47xx_wdt.c b/drivers/watchdog/bcm47xx_wdt.c
> index 05425c1dfd4c..841ca1839f7f 100644
> --- a/drivers/watchdog/bcm47xx_wdt.c
> +++ b/drivers/watchdog/bcm47xx_wdt.c
> @@ -218,13 +218,11 @@ static int bcm47xx_wdt_probe(struct platform_device *pdev)
>   	return ret;
>   }
>   
> -static int bcm47xx_wdt_remove(struct platform_device *pdev)
> +static void bcm47xx_wdt_remove(struct platform_device *pdev)
>   {
>   	struct bcm47xx_wdt *wdt = dev_get_platdata(&pdev->dev);
>   
>   	watchdog_unregister_device(&wdt->wdd);
> -
> -	return 0;
>   }
>   
>   static struct platform_driver bcm47xx_wdt_driver = {
> @@ -232,7 +230,7 @@ static struct platform_driver bcm47xx_wdt_driver = {
>   		.name	= "bcm47xx-wdt",
>   	},
>   	.probe		= bcm47xx_wdt_probe,
> -	.remove		= bcm47xx_wdt_remove,
> +	.remove_new	= bcm47xx_wdt_remove,

Much better would be to call devm_watchdog_register_device() instead of
watchdog_register_device() and drop the remove function entirely.

Guenter


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

* Re: [PATCH 02/34] watchdog: acquirewdt: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 02/34] watchdog: acquirewdt: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-03-04 17:02   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:02 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:36:44PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/acquirewdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/acquirewdt.c b/drivers/watchdog/acquirewdt.c
> index bc6f333565d3..53b04abd55b0 100644
> --- a/drivers/watchdog/acquirewdt.c
> +++ b/drivers/watchdog/acquirewdt.c
> @@ -271,14 +271,12 @@ static int __init acq_probe(struct platform_device *dev)
>  	return ret;
>  }
>  
> -static int acq_remove(struct platform_device *dev)
> +static void acq_remove(struct platform_device *dev)
>  {
>  	misc_deregister(&acq_miscdev);
>  	release_region(wdt_start, 1);
>  	if (wdt_stop != wdt_start)
>  		release_region(wdt_stop, 1);
> -
> -	return 0;
>  }
>  
>  static void acq_shutdown(struct platform_device *dev)
> @@ -288,7 +286,7 @@ static void acq_shutdown(struct platform_device *dev)
>  }
>  
>  static struct platform_driver acquirewdt_driver = {
> -	.remove		= acq_remove,
> +	.remove_new	= acq_remove,
>  	.shutdown	= acq_shutdown,
>  	.driver		= {
>  		.name	= DRV_NAME,
> -- 
> 2.39.1
> 

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

* Re: [PATCH 03/34] watchdog: advantechwdt: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 03/34] watchdog: advantechwdt: " Uwe Kleine-König
@ 2023-03-04 17:02   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:02 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:36:45PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/advantechwdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/advantechwdt.c b/drivers/watchdog/advantechwdt.c
> index 554fe85da50e..7a0acbc3e4dd 100644
> --- a/drivers/watchdog/advantechwdt.c
> +++ b/drivers/watchdog/advantechwdt.c
> @@ -279,14 +279,12 @@ static int __init advwdt_probe(struct platform_device *dev)
>  	goto out;
>  }
>  
> -static int advwdt_remove(struct platform_device *dev)
> +static void advwdt_remove(struct platform_device *dev)
>  {
>  	misc_deregister(&advwdt_miscdev);
>  	release_region(wdt_start, 1);
>  	if (wdt_stop != wdt_start)
>  		release_region(wdt_stop, 1);
> -
> -	return 0;
>  }
>  
>  static void advwdt_shutdown(struct platform_device *dev)
> @@ -296,7 +294,7 @@ static void advwdt_shutdown(struct platform_device *dev)
>  }
>  
>  static struct platform_driver advwdt_driver = {
> -	.remove		= advwdt_remove,
> +	.remove_new	= advwdt_remove,
>  	.shutdown	= advwdt_shutdown,
>  	.driver		= {
>  		.name	= DRV_NAME,
> -- 
> 2.39.1
> 

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

* Re: [PATCH 04/34] watchdog: ar7: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 04/34] watchdog: ar7: " Uwe Kleine-König
@ 2023-03-04 17:02   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:02 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:36:46PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/ar7_wdt.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/ar7_wdt.c b/drivers/watchdog/ar7_wdt.c
> index 743e171d97a3..cdcaeb0961ac 100644
> --- a/drivers/watchdog/ar7_wdt.c
> +++ b/drivers/watchdog/ar7_wdt.c
> @@ -290,12 +290,11 @@ static int ar7_wdt_probe(struct platform_device *pdev)
>  	return rc;
>  }
>  
> -static int ar7_wdt_remove(struct platform_device *pdev)
> +static void ar7_wdt_remove(struct platform_device *pdev)
>  {
>  	misc_deregister(&ar7_wdt_miscdev);
>  	clk_put(vbus_clk);
>  	vbus_clk = NULL;
> -	return 0;
>  }
>  
>  static void ar7_wdt_shutdown(struct platform_device *pdev)
> @@ -306,7 +305,7 @@ static void ar7_wdt_shutdown(struct platform_device *pdev)
>  
>  static struct platform_driver ar7_wdt_driver = {
>  	.probe = ar7_wdt_probe,
> -	.remove = ar7_wdt_remove,
> +	.remove_new = ar7_wdt_remove,
>  	.shutdown = ar7_wdt_shutdown,
>  	.driver = {
>  		.name = "ar7_wdt",
> -- 
> 2.39.1
> 

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

* Re: [PATCH 05/34] watchdog: at91rm9200: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 05/34] watchdog: at91rm9200: " Uwe Kleine-König
@ 2023-03-04 17:02   ` Guenter Roeck
  2023-03-06 11:55   ` Claudiu.Beznea
  1 sibling, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:02 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Wim Van Sebroeck, Nicolas Ferre, Alexandre Belloni,
	Claudiu Beznea, linux-watchdog, linux-arm-kernel, kernel

On Fri, Mar 03, 2023 at 10:36:47PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/at91rm9200_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c
> index d57409c1a4d1..d20ec27ba354 100644
> --- a/drivers/watchdog/at91rm9200_wdt.c
> +++ b/drivers/watchdog/at91rm9200_wdt.c
> @@ -258,7 +258,7 @@ static int at91wdt_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int at91wdt_remove(struct platform_device *pdev)
> +static void at91wdt_remove(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
>  	int res;
> @@ -269,8 +269,6 @@ static int at91wdt_remove(struct platform_device *pdev)
>  
>  	misc_deregister(&at91wdt_miscdev);
>  	at91wdt_miscdev.parent = NULL;
> -
> -	return 0;
>  }
>  
>  static void at91wdt_shutdown(struct platform_device *pdev)
> @@ -299,7 +297,7 @@ MODULE_DEVICE_TABLE(of, at91_wdt_dt_ids);
>  
>  static struct platform_driver at91wdt_driver = {
>  	.probe		= at91wdt_probe,
> -	.remove		= at91wdt_remove,
> +	.remove_new	= at91wdt_remove,
>  	.shutdown	= at91wdt_shutdown,
>  	.suspend	= pm_ptr(at91wdt_suspend),
>  	.resume		= pm_ptr(at91wdt_resume),
> -- 
> 2.39.1
> 

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

* Re: [PATCH 06/34] watchdog: ath79: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 06/34] watchdog: ath79: " Uwe Kleine-König
@ 2023-03-04 17:02   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:02 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:36:48PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/ath79_wdt.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/ath79_wdt.c b/drivers/watchdog/ath79_wdt.c
> index 0f18f06a21b6..b7b705060438 100644
> --- a/drivers/watchdog/ath79_wdt.c
> +++ b/drivers/watchdog/ath79_wdt.c
> @@ -296,11 +296,10 @@ static int ath79_wdt_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int ath79_wdt_remove(struct platform_device *pdev)
> +static void ath79_wdt_remove(struct platform_device *pdev)
>  {
>  	misc_deregister(&ath79_wdt_miscdev);
>  	clk_disable_unprepare(wdt_clk);
> -	return 0;
>  }
>  
>  static void ath79_wdt_shutdown(struct platform_device *pdev)
> @@ -318,7 +317,7 @@ MODULE_DEVICE_TABLE(of, ath79_wdt_match);
>  
>  static struct platform_driver ath79_wdt_driver = {
>  	.probe		= ath79_wdt_probe,
> -	.remove		= ath79_wdt_remove,
> +	.remove_new	= ath79_wdt_remove,
>  	.shutdown	= ath79_wdt_shutdown,
>  	.driver		= {
>  		.name	= DRIVER_NAME,
> -- 
> 2.39.1
> 

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

* Re: [PATCH 07/34] watchdog: bcm2835: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 07/34] watchdog: bcm2835: " Uwe Kleine-König
  2023-03-03 21:38   ` Florian Fainelli
@ 2023-03-04 17:04   ` Guenter Roeck
  1 sibling, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:04 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Wim Van Sebroeck, Florian Fainelli, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, linux-watchdog,
	linux-rpi-kernel, linux-arm-kernel, kernel

On Fri, Mar 03, 2023 at 10:36:49PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/bcm2835_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c
> index 94907176a0e4..7a855289ff5e 100644
> --- a/drivers/watchdog/bcm2835_wdt.c
> +++ b/drivers/watchdog/bcm2835_wdt.c
> @@ -218,17 +218,15 @@ static int bcm2835_wdt_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int bcm2835_wdt_remove(struct platform_device *pdev)
> +static void bcm2835_wdt_remove(struct platform_device *pdev)
>  {
>  	if (pm_power_off == bcm2835_power_off)
>  		pm_power_off = NULL;
> -
> -	return 0;
>  }
>  
>  static struct platform_driver bcm2835_wdt_driver = {
>  	.probe		= bcm2835_wdt_probe,
> -	.remove		= bcm2835_wdt_remove,
> +	.remove_new	= bcm2835_wdt_remove,
>  	.driver = {
>  		.name =		"bcm2835-wdt",
>  	},
> -- 
> 2.39.1
> 

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

* Re: [PATCH 09/34] watchdog: bcm_kona: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 09/34] watchdog: bcm_kona: " Uwe Kleine-König
  2023-03-03 21:39   ` Florian Fainelli
@ 2023-03-04 17:05   ` Guenter Roeck
  1 sibling, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:05 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Wim Van Sebroeck, Florian Fainelli, Ray Jui, Scott Branden,
	Broadcom internal kernel review list, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:36:51PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/bcm_kona_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c
> index 8237c4e9c2a0..49e12d47b073 100644
> --- a/drivers/watchdog/bcm_kona_wdt.c
> +++ b/drivers/watchdog/bcm_kona_wdt.c
> @@ -310,12 +310,10 @@ static int bcm_kona_wdt_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int bcm_kona_wdt_remove(struct platform_device *pdev)
> +static void bcm_kona_wdt_remove(struct platform_device *pdev)
>  {
>  	bcm_kona_wdt_debug_exit(pdev);
>  	dev_dbg(&pdev->dev, "Watchdog driver disabled");
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id bcm_kona_wdt_of_match[] = {
> @@ -330,7 +328,7 @@ static struct platform_driver bcm_kona_wdt_driver = {
>  			.of_match_table = bcm_kona_wdt_of_match,
>  		  },
>  	.probe = bcm_kona_wdt_probe,
> -	.remove = bcm_kona_wdt_remove,
> +	.remove_new = bcm_kona_wdt_remove,
>  };
>  
>  module_platform_driver(bcm_kona_wdt_driver);
> -- 
> 2.39.1
> 

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

* Re: [PATCH 10/34] watchdog: cpwd: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 10/34] watchdog: cpwd: " Uwe Kleine-König
@ 2023-03-04 17:05   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:05 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:36:52PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/cpwd.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c
> index 1eafe0b4d71c..47250f9b68c7 100644
> --- a/drivers/watchdog/cpwd.c
> +++ b/drivers/watchdog/cpwd.c
> @@ -614,7 +614,7 @@ static int cpwd_probe(struct platform_device *op)
>  	return err;
>  }
>  
> -static int cpwd_remove(struct platform_device *op)
> +static void cpwd_remove(struct platform_device *op)
>  {
>  	struct cpwd *p = platform_get_drvdata(op);
>  	int i;
> @@ -638,8 +638,6 @@ static int cpwd_remove(struct platform_device *op)
>  	of_iounmap(&op->resource[0], p->regs, 4 * WD_TIMER_REGSZ);
>  
>  	cpwd_device = NULL;
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id cpwd_match[] = {
> @@ -656,7 +654,7 @@ static struct platform_driver cpwd_driver = {
>  		.of_match_table = cpwd_match,
>  	},
>  	.probe		= cpwd_probe,
> -	.remove		= cpwd_remove,
> +	.remove_new	= cpwd_remove,
>  };
>  
>  module_platform_driver(cpwd_driver);
> -- 
> 2.39.1
> 

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

* Re: [PATCH 11/34] watchdog: dw: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 11/34] watchdog: dw: " Uwe Kleine-König
@ 2023-03-04 17:06   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:06 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:36:53PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/dw_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
> index 462f15bd5ffa..6f88bd81f8a1 100644
> --- a/drivers/watchdog/dw_wdt.c
> +++ b/drivers/watchdog/dw_wdt.c
> @@ -681,7 +681,7 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int dw_wdt_drv_remove(struct platform_device *pdev)
> +static void dw_wdt_drv_remove(struct platform_device *pdev)
>  {
>  	struct dw_wdt *dw_wdt = platform_get_drvdata(pdev);
>  
> @@ -691,8 +691,6 @@ static int dw_wdt_drv_remove(struct platform_device *pdev)
>  	reset_control_assert(dw_wdt->rst);
>  	clk_disable_unprepare(dw_wdt->pclk);
>  	clk_disable_unprepare(dw_wdt->clk);
> -
> -	return 0;
>  }
>  
>  #ifdef CONFIG_OF
> @@ -705,7 +703,7 @@ MODULE_DEVICE_TABLE(of, dw_wdt_of_match);
>  
>  static struct platform_driver dw_wdt_driver = {
>  	.probe		= dw_wdt_drv_probe,
> -	.remove		= dw_wdt_drv_remove,
> +	.remove_new	= dw_wdt_drv_remove,
>  	.driver		= {
>  		.name	= "dw_wdt",
>  		.of_match_table = of_match_ptr(dw_wdt_of_match),
> -- 
> 2.39.1
> 

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

* Re: [PATCH 12/34] watchdog: gef: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 12/34] watchdog: gef: " Uwe Kleine-König
@ 2023-03-04 17:06   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:06 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:36:54PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/gef_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/gef_wdt.c b/drivers/watchdog/gef_wdt.c
> index df5406aa7d25..97afc907f659 100644
> --- a/drivers/watchdog/gef_wdt.c
> +++ b/drivers/watchdog/gef_wdt.c
> @@ -283,15 +283,13 @@ static int gef_wdt_probe(struct platform_device *dev)
>  	return misc_register(&gef_wdt_miscdev);
>  }
>  
> -static int gef_wdt_remove(struct platform_device *dev)
> +static void gef_wdt_remove(struct platform_device *dev)
>  {
>  	misc_deregister(&gef_wdt_miscdev);
>  
>  	gef_wdt_handler_disable();
>  
>  	iounmap(gef_wdt_regs);
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id gef_wdt_ids[] = {
> @@ -308,7 +306,7 @@ static struct platform_driver gef_wdt_driver = {
>  		.of_match_table = gef_wdt_ids,
>  	},
>  	.probe		= gef_wdt_probe,
> -	.remove		= gef_wdt_remove,
> +	.remove_new	= gef_wdt_remove,
>  };
>  
>  static int __init gef_wdt_init(void)
> -- 
> 2.39.1
> 

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

* Re: [PATCH 13/34] watchdog: geodewdt: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 13/34] watchdog: geodewdt: " Uwe Kleine-König
@ 2023-03-04 17:07   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:07 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:36:55PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/geodewdt.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c
> index 0b699c783d57..5186c37ad451 100644
> --- a/drivers/watchdog/geodewdt.c
> +++ b/drivers/watchdog/geodewdt.c
> @@ -238,10 +238,9 @@ static int __init geodewdt_probe(struct platform_device *dev)
>  	return ret;
>  }
>  
> -static int geodewdt_remove(struct platform_device *dev)
> +static void geodewdt_remove(struct platform_device *dev)
>  {
>  	misc_deregister(&geodewdt_miscdev);
> -	return 0;
>  }
>  
>  static void geodewdt_shutdown(struct platform_device *dev)
> @@ -250,7 +249,7 @@ static void geodewdt_shutdown(struct platform_device *dev)
>  }
>  
>  static struct platform_driver geodewdt_driver = {
> -	.remove		= geodewdt_remove,
> +	.remove_new	= geodewdt_remove,
>  	.shutdown	= geodewdt_shutdown,
>  	.driver		= {
>  		.name	= DRV_NAME,
> -- 
> 2.39.1
> 

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

* Re: [PATCH 14/34] watchdog: ib700wdt: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 14/34] watchdog: ib700wdt: " Uwe Kleine-König
@ 2023-03-04 17:07   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:07 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:36:56PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/ib700wdt.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/ib700wdt.c b/drivers/watchdog/ib700wdt.c
> index a0ddedc362fc..39ea97009abd 100644
> --- a/drivers/watchdog/ib700wdt.c
> +++ b/drivers/watchdog/ib700wdt.c
> @@ -316,14 +316,13 @@ static int __init ibwdt_probe(struct platform_device *dev)
>  	return res;
>  }
>  
> -static int ibwdt_remove(struct platform_device *dev)
> +static void ibwdt_remove(struct platform_device *dev)
>  {
>  	misc_deregister(&ibwdt_miscdev);
>  	release_region(WDT_START, 1);
>  #if WDT_START != WDT_STOP
>  	release_region(WDT_STOP, 1);
>  #endif
> -	return 0;
>  }
>  
>  static void ibwdt_shutdown(struct platform_device *dev)
> @@ -333,7 +332,7 @@ static void ibwdt_shutdown(struct platform_device *dev)
>  }
>  
>  static struct platform_driver ibwdt_driver = {
> -	.remove		= ibwdt_remove,
> +	.remove_new	= ibwdt_remove,
>  	.shutdown	= ibwdt_shutdown,
>  	.driver		= {
>  		.name	= DRV_NAME,
> -- 
> 2.39.1
> 

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

* Re: [PATCH 15/34] watchdog: ie6xx: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 15/34] watchdog: ie6xx: " Uwe Kleine-König
@ 2023-03-04 17:07   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:07 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:36:57PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/ie6xx_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/ie6xx_wdt.c b/drivers/watchdog/ie6xx_wdt.c
> index 8f28993fab8b..e5cbb409df25 100644
> --- a/drivers/watchdog/ie6xx_wdt.c
> +++ b/drivers/watchdog/ie6xx_wdt.c
> @@ -266,7 +266,7 @@ static int ie6xx_wdt_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int ie6xx_wdt_remove(struct platform_device *pdev)
> +static void ie6xx_wdt_remove(struct platform_device *pdev)
>  {
>  	struct resource *res;
>  
> @@ -276,13 +276,11 @@ static int ie6xx_wdt_remove(struct platform_device *pdev)
>  	ie6xx_wdt_debugfs_exit();
>  	release_region(res->start, resource_size(res));
>  	ie6xx_wdt_data.sch_wdtba = 0;
> -
> -	return 0;
>  }
>  
>  static struct platform_driver ie6xx_wdt_driver = {
>  	.probe		= ie6xx_wdt_probe,
> -	.remove		= ie6xx_wdt_remove,
> +	.remove_new	= ie6xx_wdt_remove,
>  	.driver		= {
>  		.name	= DRIVER_NAME,
>  	},
> -- 
> 2.39.1
> 

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

* Re: [PATCH 16/34] watchdog: lpc18xx: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 16/34] watchdog: lpc18xx: " Uwe Kleine-König
@ 2023-03-04 17:08   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:08 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Wim Van Sebroeck, Vladimir Zapolskiy, linux-watchdog,
	linux-arm-kernel, kernel

On Fri, Mar 03, 2023 at 10:36:58PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/lpc18xx_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/lpc18xx_wdt.c b/drivers/watchdog/lpc18xx_wdt.c
> index 1b9b5f21a0df..19535f4a2fd2 100644
> --- a/drivers/watchdog/lpc18xx_wdt.c
> +++ b/drivers/watchdog/lpc18xx_wdt.c
> @@ -261,14 +261,12 @@ static int lpc18xx_wdt_probe(struct platform_device *pdev)
>  	return devm_watchdog_register_device(dev, &lpc18xx_wdt->wdt_dev);
>  }
>  
> -static int lpc18xx_wdt_remove(struct platform_device *pdev)
> +static void lpc18xx_wdt_remove(struct platform_device *pdev)
>  {
>  	struct lpc18xx_wdt_dev *lpc18xx_wdt = platform_get_drvdata(pdev);
>  
>  	dev_warn(&pdev->dev, "I quit now, hardware will probably reboot!\n");
>  	del_timer_sync(&lpc18xx_wdt->timer);
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id lpc18xx_wdt_match[] = {
> @@ -283,7 +281,7 @@ static struct platform_driver lpc18xx_wdt_driver = {
>  		.of_match_table	= lpc18xx_wdt_match,
>  	},
>  	.probe = lpc18xx_wdt_probe,
> -	.remove = lpc18xx_wdt_remove,
> +	.remove_new = lpc18xx_wdt_remove,
>  };
>  module_platform_driver(lpc18xx_wdt_driver);
>  
> -- 
> 2.39.1
> 

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

* Re: [PATCH 17/34] watchdog: mtx-1: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 17/34] watchdog: mtx-1: " Uwe Kleine-König
@ 2023-03-04 17:09   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:09 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:36:59PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/mtx-1_wdt.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c
> index ea1bbf5ee528..152e41ecbb14 100644
> --- a/drivers/watchdog/mtx-1_wdt.c
> +++ b/drivers/watchdog/mtx-1_wdt.c
> @@ -221,7 +221,7 @@ static int mtx1_wdt_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int mtx1_wdt_remove(struct platform_device *pdev)
> +static void mtx1_wdt_remove(struct platform_device *pdev)
>  {
>  	/* FIXME: do we need to lock this test ? */
>  	if (mtx1_wdt_device.queue) {
> @@ -230,12 +230,11 @@ static int mtx1_wdt_remove(struct platform_device *pdev)
>  	}
>  
>  	misc_deregister(&mtx1_wdt_misc);
> -	return 0;
>  }
>  
>  static struct platform_driver mtx1_wdt_driver = {
>  	.probe = mtx1_wdt_probe,
> -	.remove = mtx1_wdt_remove,
> +	.remove_new = mtx1_wdt_remove,
>  	.driver.name = "mtx1-wdt",
>  	.driver.owner = THIS_MODULE,
>  };
> -- 
> 2.39.1
> 

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

* Re: [PATCH 18/34] watchdog: nic7018: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 18/34] watchdog: nic7018: " Uwe Kleine-König
@ 2023-03-04 17:09   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:09 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:00PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/nic7018_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/nic7018_wdt.c b/drivers/watchdog/nic7018_wdt.c
> index 2a46cc662943..c3f0a4926667 100644
> --- a/drivers/watchdog/nic7018_wdt.c
> +++ b/drivers/watchdog/nic7018_wdt.c
> @@ -218,7 +218,7 @@ static int nic7018_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int nic7018_remove(struct platform_device *pdev)
> +static void nic7018_remove(struct platform_device *pdev)
>  {
>  	struct nic7018_wdt *wdt = platform_get_drvdata(pdev);
>  
> @@ -226,8 +226,6 @@ static int nic7018_remove(struct platform_device *pdev)
>  
>  	/* Lock WDT register */
>  	outb(LOCK, wdt->io_base + WDT_REG_LOCK);
> -
> -	return 0;
>  }
>  
>  static const struct acpi_device_id nic7018_device_ids[] = {
> @@ -238,7 +236,7 @@ MODULE_DEVICE_TABLE(acpi, nic7018_device_ids);
>  
>  static struct platform_driver watchdog_driver = {
>  	.probe = nic7018_probe,
> -	.remove = nic7018_remove,
> +	.remove_new = nic7018_remove,
>  	.driver = {
>  		.name = KBUILD_MODNAME,
>  		.acpi_match_table = ACPI_PTR(nic7018_device_ids),
> -- 
> 2.39.1
> 

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

* Re: [PATCH 19/34] watchdog: nv_tco: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 19/34] watchdog: nv_tco: " Uwe Kleine-König
@ 2023-03-04 17:09   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:09 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:01PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/nv_tco.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/nv_tco.c b/drivers/watchdog/nv_tco.c
> index f6902a337422..ac4a9c16341d 100644
> --- a/drivers/watchdog/nv_tco.c
> +++ b/drivers/watchdog/nv_tco.c
> @@ -446,12 +446,10 @@ static void nv_tco_cleanup(void)
>  	release_region(tcobase, 0x10);
>  }
>  
> -static int nv_tco_remove(struct platform_device *dev)
> +static void nv_tco_remove(struct platform_device *dev)
>  {
>  	if (tcobase)
>  		nv_tco_cleanup();
> -
> -	return 0;
>  }
>  
>  static void nv_tco_shutdown(struct platform_device *dev)
> @@ -469,7 +467,7 @@ static void nv_tco_shutdown(struct platform_device *dev)
>  
>  static struct platform_driver nv_tco_driver = {
>  	.probe		= nv_tco_init,
> -	.remove		= nv_tco_remove,
> +	.remove_new	= nv_tco_remove,
>  	.shutdown	= nv_tco_shutdown,
>  	.driver		= {
>  		.name	= TCO_MODULE_NAME,
> -- 
> 2.39.1
> 

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

* Re: [PATCH 20/34] watchdog: omap: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 20/34] watchdog: omap: " Uwe Kleine-König
@ 2023-03-04 17:09   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:09 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:02PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/omap_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
> index e75aa86f63cb..a7a12f2fe9de 100644
> --- a/drivers/watchdog/omap_wdt.c
> +++ b/drivers/watchdog/omap_wdt.c
> @@ -306,14 +306,12 @@ static void omap_wdt_shutdown(struct platform_device *pdev)
>  	mutex_unlock(&wdev->lock);
>  }
>  
> -static int omap_wdt_remove(struct platform_device *pdev)
> +static void omap_wdt_remove(struct platform_device *pdev)
>  {
>  	struct omap_wdt_dev *wdev = platform_get_drvdata(pdev);
>  
>  	pm_runtime_disable(wdev->dev);
>  	watchdog_unregister_device(&wdev->wdog);
> -
> -	return 0;
>  }
>  
>  /* REVISIT ... not clear this is the best way to handle system suspend; and
> @@ -359,7 +357,7 @@ MODULE_DEVICE_TABLE(of, omap_wdt_of_match);
>  
>  static struct platform_driver omap_wdt_driver = {
>  	.probe		= omap_wdt_probe,
> -	.remove		= omap_wdt_remove,
> +	.remove_new	= omap_wdt_remove,
>  	.shutdown	= omap_wdt_shutdown,
>  	.suspend	= pm_ptr(omap_wdt_suspend),
>  	.resume		= pm_ptr(omap_wdt_resume),
> -- 
> 2.39.1
> 

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

* Re: [PATCH 21/34] watchdog: orion: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 21/34] watchdog: orion: " Uwe Kleine-König
@ 2023-03-04 17:10   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:10 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:03PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/orion_wdt.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
> index e25e6bf4647f..5ec2dd8fd5fa 100644
> --- a/drivers/watchdog/orion_wdt.c
> +++ b/drivers/watchdog/orion_wdt.c
> @@ -649,7 +649,7 @@ static int orion_wdt_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int orion_wdt_remove(struct platform_device *pdev)
> +static void orion_wdt_remove(struct platform_device *pdev)
>  {
>  	struct watchdog_device *wdt_dev = platform_get_drvdata(pdev);
>  	struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev);
> @@ -657,7 +657,6 @@ static int orion_wdt_remove(struct platform_device *pdev)
>  	watchdog_unregister_device(wdt_dev);
>  	clk_disable_unprepare(dev->clk);
>  	clk_put(dev->clk);
> -	return 0;
>  }
>  
>  static void orion_wdt_shutdown(struct platform_device *pdev)
> @@ -668,7 +667,7 @@ static void orion_wdt_shutdown(struct platform_device *pdev)
>  
>  static struct platform_driver orion_wdt_driver = {
>  	.probe		= orion_wdt_probe,
> -	.remove		= orion_wdt_remove,
> +	.remove_new	= orion_wdt_remove,
>  	.shutdown	= orion_wdt_shutdown,
>  	.driver		= {
>  		.name	= "orion_wdt",
> -- 
> 2.39.1
> 

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

* Re: [PATCH 22/34] watchdog: rc32434: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 22/34] watchdog: rc32434: " Uwe Kleine-König
@ 2023-03-04 17:10   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:10 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:04PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/rc32434_wdt.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c
> index e74802f3a32e..417f9b75679c 100644
> --- a/drivers/watchdog/rc32434_wdt.c
> +++ b/drivers/watchdog/rc32434_wdt.c
> @@ -298,10 +298,9 @@ static int rc32434_wdt_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int rc32434_wdt_remove(struct platform_device *pdev)
> +static void rc32434_wdt_remove(struct platform_device *pdev)
>  {
>  	misc_deregister(&rc32434_wdt_miscdev);
> -	return 0;
>  }
>  
>  static void rc32434_wdt_shutdown(struct platform_device *pdev)
> @@ -311,7 +310,7 @@ static void rc32434_wdt_shutdown(struct platform_device *pdev)
>  
>  static struct platform_driver rc32434_wdt_driver = {
>  	.probe		= rc32434_wdt_probe,
> -	.remove		= rc32434_wdt_remove,
> +	.remove_new	= rc32434_wdt_remove,
>  	.shutdown	= rc32434_wdt_shutdown,
>  	.driver		= {
>  			.name = "rc32434_wdt",
> -- 
> 2.39.1
> 

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

* Re: [PATCH 23/34] watchdog: rdc321x: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 23/34] watchdog: rdc321x: " Uwe Kleine-König
@ 2023-03-04 17:10   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:10 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:05PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/rdc321x_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/rdc321x_wdt.c b/drivers/watchdog/rdc321x_wdt.c
> index f0c94ea51c3e..6176f4343fc5 100644
> --- a/drivers/watchdog/rdc321x_wdt.c
> +++ b/drivers/watchdog/rdc321x_wdt.c
> @@ -257,7 +257,7 @@ static int rdc321x_wdt_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int rdc321x_wdt_remove(struct platform_device *pdev)
> +static void rdc321x_wdt_remove(struct platform_device *pdev)
>  {
>  	if (rdc321x_wdt_device.queue) {
>  		rdc321x_wdt_device.queue = 0;
> @@ -265,13 +265,11 @@ static int rdc321x_wdt_remove(struct platform_device *pdev)
>  	}
>  
>  	misc_deregister(&rdc321x_wdt_misc);
> -
> -	return 0;
>  }
>  
>  static struct platform_driver rdc321x_wdt_driver = {
>  	.probe = rdc321x_wdt_probe,
> -	.remove = rdc321x_wdt_remove,
> +	.remove_new = rdc321x_wdt_remove,
>  	.driver = {
>  		.name = "rdc321x-wdt",
>  	},
> -- 
> 2.39.1
> 

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

* Re: [PATCH 24/34] watchdog: renesas: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 24/34] watchdog: renesas: " Uwe Kleine-König
@ 2023-03-04 17:10   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:10 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:06PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/renesas_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c
> index 41d58ea5eb2f..12c41d6e5cd6 100644
> --- a/drivers/watchdog/renesas_wdt.c
> +++ b/drivers/watchdog/renesas_wdt.c
> @@ -292,14 +292,12 @@ static int rwdt_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int rwdt_remove(struct platform_device *pdev)
> +static void rwdt_remove(struct platform_device *pdev)
>  {
>  	struct rwdt_priv *priv = platform_get_drvdata(pdev);
>  
>  	watchdog_unregister_device(&priv->wdev);
>  	pm_runtime_disable(&pdev->dev);
> -
> -	return 0;
>  }
>  
>  static int __maybe_unused rwdt_suspend(struct device *dev)
> @@ -339,7 +337,7 @@ static struct platform_driver rwdt_driver = {
>  		.pm = &rwdt_pm_ops,
>  	},
>  	.probe = rwdt_probe,
> -	.remove = rwdt_remove,
> +	.remove_new = rwdt_remove,
>  };
>  module_platform_driver(rwdt_driver);
>  
> -- 
> 2.39.1
> 

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

* Re: [PATCH 25/34] watchdog: riowd: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 25/34] watchdog: riowd: " Uwe Kleine-König
@ 2023-03-04 17:10   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:10 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:07PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/riowd.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/riowd.c b/drivers/watchdog/riowd.c
> index 747e346ed06c..c04b383e1712 100644
> --- a/drivers/watchdog/riowd.c
> +++ b/drivers/watchdog/riowd.c
> @@ -217,14 +217,12 @@ static int riowd_probe(struct platform_device *op)
>  	return err;
>  }
>  
> -static int riowd_remove(struct platform_device *op)
> +static void riowd_remove(struct platform_device *op)
>  {
>  	struct riowd *p = platform_get_drvdata(op);
>  
>  	misc_deregister(&riowd_miscdev);
>  	of_iounmap(&op->resource[0], p->regs, 2);
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id riowd_match[] = {
> @@ -241,7 +239,7 @@ static struct platform_driver riowd_driver = {
>  		.of_match_table = riowd_match,
>  	},
>  	.probe		= riowd_probe,
> -	.remove		= riowd_remove,
> +	.remove_new	= riowd_remove,
>  };
>  
>  module_platform_driver(riowd_driver);
> -- 
> 2.39.1
> 

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

* Re: [PATCH 26/34] watchdog: rn5t618: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 26/34] watchdog: rn5t618: " Uwe Kleine-König
@ 2023-03-04 17:12   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:12 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:08PM +0100, 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 (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/watchdog/rn5t618_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/rn5t618_wdt.c b/drivers/watchdog/rn5t618_wdt.c
> index 40d8ebd8c0ac..b0da5cc8ccdf 100644
> --- a/drivers/watchdog/rn5t618_wdt.c
> +++ b/drivers/watchdog/rn5t618_wdt.c
> @@ -181,18 +181,16 @@ static int rn5t618_wdt_probe(struct platform_device *pdev)
>  	return watchdog_register_device(&wdt->wdt_dev);
>  }
>  
> -static int rn5t618_wdt_remove(struct platform_device *pdev)
> +static void rn5t618_wdt_remove(struct platform_device *pdev)
>  {
>  	struct rn5t618_wdt *wdt = platform_get_drvdata(pdev);
>  
>  	watchdog_unregister_device(&wdt->wdt_dev);
> -
> -	return 0;
>  }

Better call devm_watchdog_register_device() in the probe function and drop
the remove function entirely.

Guenter

>  
>  static struct platform_driver rn5t618_wdt_driver = {
>  	.probe = rn5t618_wdt_probe,
> -	.remove = rn5t618_wdt_remove,
> +	.remove_new = rn5t618_wdt_remove,
>  	.driver = {
>  		.name	= DRIVER_NAME,
>  	},
> -- 
> 2.39.1
> 

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

* Re: [PATCH 27/34] watchdog: rti: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 27/34] watchdog: rti: " Uwe Kleine-König
@ 2023-03-04 17:12   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:12 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:09PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/rti_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
> index 6e9253761fc1..ce8f18e93aa9 100644
> --- a/drivers/watchdog/rti_wdt.c
> +++ b/drivers/watchdog/rti_wdt.c
> @@ -304,15 +304,13 @@ static int rti_wdt_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int rti_wdt_remove(struct platform_device *pdev)
> +static void rti_wdt_remove(struct platform_device *pdev)
>  {
>  	struct rti_wdt_device *wdt = platform_get_drvdata(pdev);
>  
>  	watchdog_unregister_device(&wdt->wdd);
>  	pm_runtime_put(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
> -
> -	return 0;
>  }
>  
>  static const struct of_device_id rti_wdt_of_match[] = {
> @@ -327,7 +325,7 @@ static struct platform_driver rti_wdt_driver = {
>  		.of_match_table = rti_wdt_of_match,
>  	},
>  	.probe = rti_wdt_probe,
> -	.remove = rti_wdt_remove,
> +	.remove_new = rti_wdt_remove,
>  };
>  
>  module_platform_driver(rti_wdt_driver);
> -- 
> 2.39.1
> 

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

* Re: [PATCH 28/34] watchdog: s3c2410: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 28/34] watchdog: s3c2410: " Uwe Kleine-König
@ 2023-03-04 17:12   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:12 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Krzysztof Kozlowski, Wim Van Sebroeck, Alim Akhtar,
	linux-arm-kernel, linux-samsung-soc, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:10PM +0100, 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 (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>

Should no longer be necessary with the two patches I sent a short
time ago.

Guenter

> ---
>  drivers/watchdog/s3c2410_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
> index cf104a844a43..d1f408913843 100644
> --- a/drivers/watchdog/s3c2410_wdt.c
> +++ b/drivers/watchdog/s3c2410_wdt.c
> @@ -775,7 +775,7 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int s3c2410wdt_remove(struct platform_device *dev)
> +static void s3c2410wdt_remove(struct platform_device *dev)
>  {
>  	int ret;
>  	struct s3c2410_wdt *wdt = platform_get_drvdata(dev);
> @@ -789,8 +789,6 @@ static int s3c2410wdt_remove(struct platform_device *dev)
>  
>  	clk_disable_unprepare(wdt->src_clk);
>  	clk_disable_unprepare(wdt->bus_clk);
> -
> -	return 0;
>  }
>  
>  static void s3c2410wdt_shutdown(struct platform_device *dev)
> @@ -845,7 +843,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(s3c2410wdt_pm_ops,
>  
>  static struct platform_driver s3c2410wdt_driver = {
>  	.probe		= s3c2410wdt_probe,
> -	.remove		= s3c2410wdt_remove,
> +	.remove_new	= s3c2410wdt_remove,
>  	.shutdown	= s3c2410wdt_shutdown,
>  	.id_table	= s3c2410_wdt_ids,
>  	.driver		= {
> -- 
> 2.39.1
> 

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

* Re: [PATCH 29/34] watchdog: sa1100: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 29/34] watchdog: sa1100: " Uwe Kleine-König
@ 2023-03-04 17:13   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:13 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:11PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/sa1100_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c
> index 82ac5d19f519..5d2df008b92a 100644
> --- a/drivers/watchdog/sa1100_wdt.c
> +++ b/drivers/watchdog/sa1100_wdt.c
> @@ -229,19 +229,17 @@ static int sa1100dog_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int sa1100dog_remove(struct platform_device *pdev)
> +static void sa1100dog_remove(struct platform_device *pdev)
>  {
>  	misc_deregister(&sa1100dog_miscdev);
>  	clk_disable_unprepare(clk);
>  	clk_put(clk);
> -
> -	return 0;
>  }
>  
>  static struct platform_driver sa1100dog_driver = {
>  	.driver.name = "sa1100_wdt",
>  	.probe	  = sa1100dog_probe,
> -	.remove	  = sa1100dog_remove,
> +	.remove_new	  = sa1100dog_remove,
>  };
>  module_platform_driver(sa1100dog_driver);
>  
> -- 
> 2.39.1
> 

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

* Re: [PATCH 30/34] watchdog: sch311x: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 30/34] watchdog: sch311x: " Uwe Kleine-König
@ 2023-03-04 17:13   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:13 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:12PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/sch311x_wdt.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/sch311x_wdt.c b/drivers/watchdog/sch311x_wdt.c
> index d8b77fe10eba..409d49880170 100644
> --- a/drivers/watchdog/sch311x_wdt.c
> +++ b/drivers/watchdog/sch311x_wdt.c
> @@ -425,7 +425,7 @@ static int sch311x_wdt_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> -static int sch311x_wdt_remove(struct platform_device *pdev)
> +static void sch311x_wdt_remove(struct platform_device *pdev)
>  {
>  	/* Stop the timer before we leave */
>  	if (!nowayout)
> @@ -436,7 +436,6 @@ static int sch311x_wdt_remove(struct platform_device *pdev)
>  	release_region(sch311x_wdt_data.runtime_reg + WDT_TIME_OUT, 4);
>  	release_region(sch311x_wdt_data.runtime_reg + GP60, 1);
>  	sch311x_wdt_data.runtime_reg = 0;
> -	return 0;
>  }
>  
>  static void sch311x_wdt_shutdown(struct platform_device *dev)
> @@ -447,7 +446,7 @@ static void sch311x_wdt_shutdown(struct platform_device *dev)
>  
>  static struct platform_driver sch311x_wdt_driver = {
>  	.probe		= sch311x_wdt_probe,
> -	.remove		= sch311x_wdt_remove,
> +	.remove_new	= sch311x_wdt_remove,
>  	.shutdown	= sch311x_wdt_shutdown,
>  	.driver		= {
>  		.name = DRV_NAME,
> -- 
> 2.39.1
> 

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

* Re: [PATCH 31/34] watchdog: shwdt: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 31/34] watchdog: shwdt: " Uwe Kleine-König
@ 2023-03-04 17:13   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:13 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:13PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/shwdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c
> index f55533e0e045..10f1fba78ec2 100644
> --- a/drivers/watchdog/shwdt.c
> +++ b/drivers/watchdog/shwdt.c
> @@ -279,13 +279,11 @@ static int sh_wdt_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int sh_wdt_remove(struct platform_device *pdev)
> +static void sh_wdt_remove(struct platform_device *pdev)
>  {
>  	watchdog_unregister_device(&sh_wdt_dev);
>  
>  	pm_runtime_disable(&pdev->dev);
> -
> -	return 0;
>  }
>  
>  static void sh_wdt_shutdown(struct platform_device *pdev)
> @@ -299,7 +297,7 @@ static struct platform_driver sh_wdt_driver = {
>  	},
>  
>  	.probe		= sh_wdt_probe,
> -	.remove		= sh_wdt_remove,
> +	.remove_new	= sh_wdt_remove,
>  	.shutdown	= sh_wdt_shutdown,
>  };
>  
> -- 
> 2.39.1
> 

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

* Re: [PATCH 32/34] watchdog: st_lpc: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 32/34] watchdog: st_lpc: " Uwe Kleine-König
@ 2023-03-04 17:13   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:13 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Patrice Chotard, Wim Van Sebroeck, linux-arm-kernel,
	linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:14PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/st_lpc_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/st_lpc_wdt.c b/drivers/watchdog/st_lpc_wdt.c
> index 39abecdb9dd1..d2aa43c00221 100644
> --- a/drivers/watchdog/st_lpc_wdt.c
> +++ b/drivers/watchdog/st_lpc_wdt.c
> @@ -239,13 +239,11 @@ static int st_wdog_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static int st_wdog_remove(struct platform_device *pdev)
> +static void st_wdog_remove(struct platform_device *pdev)
>  {
>  	struct st_wdog *st_wdog = watchdog_get_drvdata(&st_wdog_dev);
>  
>  	st_wdog_setup(st_wdog, false);
> -
> -	return 0;
>  }
>  
>  static int st_wdog_suspend(struct device *dev)
> @@ -295,7 +293,7 @@ static struct platform_driver st_wdog_driver = {
>  		.of_match_table = st_wdog_match,
>  	},
>  	.probe = st_wdog_probe,
> -	.remove = st_wdog_remove,
> +	.remove_new = st_wdog_remove,
>  };
>  module_platform_driver(st_wdog_driver);
>  
> -- 
> 2.39.1
> 

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

* Re: [PATCH 33/34] watchdog: stmp3xxx_rtc: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 33/34] watchdog: stmp3xxx_rtc: " Uwe Kleine-König
@ 2023-03-04 17:14   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:14 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Wim Van Sebroeck, Maxime Coquelin, Alexandre Torgue,
	linux-watchdog, linux-stm32, linux-arm-kernel, kernel

On Fri, Mar 03, 2023 at 10:37:15PM +0100, 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 (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: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/stmp3xxx_rtc_wdt.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/stmp3xxx_rtc_wdt.c b/drivers/watchdog/stmp3xxx_rtc_wdt.c
> index 7caf3aa71c6a..4b2caa9807ac 100644
> --- a/drivers/watchdog/stmp3xxx_rtc_wdt.c
> +++ b/drivers/watchdog/stmp3xxx_rtc_wdt.c
> @@ -109,10 +109,9 @@ static int stmp3xxx_wdt_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static int stmp3xxx_wdt_remove(struct platform_device *pdev)
> +static void stmp3xxx_wdt_remove(struct platform_device *pdev)
>  {
>  	unregister_reboot_notifier(&wdt_notifier);
> -	return 0;
>  }
>  
>  static int __maybe_unused stmp3xxx_wdt_suspend(struct device *dev)
> @@ -144,7 +143,7 @@ static struct platform_driver stmp3xxx_wdt_driver = {
>  		.pm = &stmp3xxx_wdt_pm_ops,
>  	},
>  	.probe = stmp3xxx_wdt_probe,
> -	.remove = stmp3xxx_wdt_remove,
> +	.remove_new = stmp3xxx_wdt_remove,
>  };
>  module_platform_driver(stmp3xxx_wdt_driver);
>  
> -- 
> 2.39.1
> 

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

* Re: [PATCH 34/34] watchdog: wm8350: Convert to platform remove callback returning void
  2023-03-03 21:37 ` [PATCH 34/34] watchdog: wm8350: " Uwe Kleine-König
@ 2023-03-04 17:14   ` Guenter Roeck
  0 siblings, 0 replies; 74+ messages in thread
From: Guenter Roeck @ 2023-03-04 17:14 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Wim Van Sebroeck, patches, linux-watchdog, kernel

On Fri, Mar 03, 2023 at 10:37:16PM +0100, 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 (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/watchdog/wm8350_wdt.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/wm8350_wdt.c b/drivers/watchdog/wm8350_wdt.c
> index 33c62d51f00a..febda195aed2 100644
> --- a/drivers/watchdog/wm8350_wdt.c
> +++ b/drivers/watchdog/wm8350_wdt.c
> @@ -156,15 +156,14 @@ static int wm8350_wdt_probe(struct platform_device *pdev)
>  	return watchdog_register_device(&wm8350_wdt);
>  }
>  
> -static int wm8350_wdt_remove(struct platform_device *pdev)
> +static void wm8350_wdt_remove(struct platform_device *pdev)
>  {
>  	watchdog_unregister_device(&wm8350_wdt);
> -	return 0;
>  }

Again, just call devm_watchdog_register_device() in the probe function
and drop the remove function entirely.

Thanks,
Guenter

>  
>  static struct platform_driver wm8350_wdt_driver = {
>  	.probe = wm8350_wdt_probe,
> -	.remove = wm8350_wdt_remove,
> +	.remove_new = wm8350_wdt_remove,
>  	.driver = {
>  		.name = "wm8350-wdt",
>  	},
> -- 
> 2.39.1
> 

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

* Re: [PATCH 05/34] watchdog: at91rm9200: Convert to platform remove callback returning void
  2023-03-03 21:36 ` [PATCH 05/34] watchdog: at91rm9200: " Uwe Kleine-König
  2023-03-04 17:02   ` Guenter Roeck
@ 2023-03-06 11:55   ` Claudiu.Beznea
  1 sibling, 0 replies; 74+ messages in thread
From: Claudiu.Beznea @ 2023-03-06 11:55 UTC (permalink / raw)
  To: u.kleine-koenig, wim, linux, Nicolas.Ferre, alexandre.belloni
  Cc: linux-watchdog, linux-arm-kernel, kernel

On 03.03.2023 23:36, 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>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>


> ---
>  drivers/watchdog/at91rm9200_wdt.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/at91rm9200_wdt.c b/drivers/watchdog/at91rm9200_wdt.c
> index d57409c1a4d1..d20ec27ba354 100644
> --- a/drivers/watchdog/at91rm9200_wdt.c
> +++ b/drivers/watchdog/at91rm9200_wdt.c
> @@ -258,7 +258,7 @@ static int at91wdt_probe(struct platform_device *pdev)
>         return 0;
>  }
> 
> -static int at91wdt_remove(struct platform_device *pdev)
> +static void at91wdt_remove(struct platform_device *pdev)
>  {
>         struct device *dev = &pdev->dev;
>         int res;
> @@ -269,8 +269,6 @@ static int at91wdt_remove(struct platform_device *pdev)
> 
>         misc_deregister(&at91wdt_miscdev);
>         at91wdt_miscdev.parent = NULL;
> -
> -       return 0;
>  }
> 
>  static void at91wdt_shutdown(struct platform_device *pdev)
> @@ -299,7 +297,7 @@ MODULE_DEVICE_TABLE(of, at91_wdt_dt_ids);
> 
>  static struct platform_driver at91wdt_driver = {
>         .probe          = at91wdt_probe,
> -       .remove         = at91wdt_remove,
> +       .remove_new     = at91wdt_remove,
>         .shutdown       = at91wdt_shutdown,
>         .suspend        = pm_ptr(at91wdt_suspend),
>         .resume         = pm_ptr(at91wdt_resume),
> --
> 2.39.1
> 


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

* Re: [PATCH 00/34] watchdog: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (33 preceding siblings ...)
  2023-03-03 21:37 ` [PATCH 34/34] watchdog: wm8350: " Uwe Kleine-König
@ 2023-03-06 17:05 ` Uwe Kleine-König
  2023-03-14  8:38 ` Naresh Kamboju
  35 siblings, 0 replies; 74+ messages in thread
From: Uwe Kleine-König @ 2023-03-06 17:05 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Wim Van Sebroeck, Guenter Roeck,
	Doug Anderson, Nicolas Ferre, Alexandre Belloni, Claudiu Beznea,
	Florian Fainelli, Ray Jui, Scott Branden, Vladimir Zapolskiy,
	Patrice Chotard, Maxime Coquelin, Alexandre Torgue
  Cc: kernel, linux-samsung-soc, linux-watchdog, patches,
	Broadcom internal kernel review list, linux-rpi-kernel,
	Alim Akhtar, linux-stm32, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 2040 bytes --]

Hello,

[dropping Leela Krishna Amudala from the list of recipents as their
email address bounces]

On Fri, Mar 03, 2023 at 10:36:42PM +0100, Uwe Kleine-König wrote:
> this patch series adapts the platform drivers below drivers/watchdog to
> use the .remove_new() callback. 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 a resource leak. One driver suffering from
> this problem (s3c2410) is fixed by the first patch.
> 
> By changing the remove callback to return void driver authors cannot
> reasonably (but wrongly) assume any more that there happens some kind of
> cleanup later.
> 
> All watchdog drivers but the above mentioned one returned zero
> unconditionally in their remove callback, so they could all be converted
> trivially to .remove_new().
> 
> Note that this series depends on commit 5c5a7680e67b ("platform: Provide
> a remove callback that returns no value") that is already in Linus' tree
> but not yet included in a tagged version.

This is fixed now, v6.3-rc1 is suitable as a base for this series.

Guenter pointed out that for some drivers it is possible to make use of
devm_watchdog_register_device() and drop the remove callback completely.
Also there is an alternative series that gets rid of s3c2410's remove
callback.

I'll send out a series converting the three drivers to
devm_watchdog_register_device() as Guenter suggested. To apply the
remainder of this series you might want to do:

	b4 am -l -P 2-7,9-25,27,29-33 20230303213716.2123717-1-u.kleine-koenig@pengutronix.de

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* [PATCH 00/34] watchdog: Convert to platform remove callback returning void
  2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
                   ` (34 preceding siblings ...)
  2023-03-06 17:05 ` [PATCH 00/34] watchdog: " Uwe Kleine-König
@ 2023-03-14  8:38 ` Naresh Kamboju
  35 siblings, 0 replies; 74+ messages in thread
From: Naresh Kamboju @ 2023-03-14  8:38 UTC (permalink / raw)
  To: u.kleine-koenig
  Cc: alexandre.belloni, alexandre.torgue, alim.akhtar,
	bcm-kernel-feedback-list, claudiu.beznea, dianders, f.fainelli,
	kernel, krzysztof.kozlowski, leela.krishna, linux-arm-kernel,
	linux-rpi-kernel, linux-samsung-soc, linux-stm32, linux-watchdog,
	linux, mcoquelin.stm32, nicolas.ferre, patches, patrice.chotard,
	rjui, sbranden, vz, wim, Linux Kernel Functional Testing


> Hello,
> 
> this patch series adapts the platform drivers below drivers/watchdog to
> use the .remove_new() callback. 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 a resource leak. One driver suffering from
> this problem (s3c2410) is fixed by the first patch.

This patch set applied on top of Linux next.

Build tested with gcc-12, clang-16 and clang nightly.
Boot and LTP smoketests performed on
 - qemu-x86_64
 - qemu-arm64
 - fvp-aemva
 - qemu-armv7
 - qemu-i386

Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>

--
Linaro LKFT
https://lkft.linaro.org

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

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

Thread overview: 74+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-03 21:36 [PATCH 00/34] watchdog: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-03 21:36 ` [PATCH 01/34] watchdog: s3c2410: Don't skip cleanup in remove's error path Uwe Kleine-König
2023-03-04 16:58   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 02/34] watchdog: acquirewdt: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-04 17:02   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 03/34] watchdog: advantechwdt: " Uwe Kleine-König
2023-03-04 17:02   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 04/34] watchdog: ar7: " Uwe Kleine-König
2023-03-04 17:02   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 05/34] watchdog: at91rm9200: " Uwe Kleine-König
2023-03-04 17:02   ` Guenter Roeck
2023-03-06 11:55   ` Claudiu.Beznea
2023-03-03 21:36 ` [PATCH 06/34] watchdog: ath79: " Uwe Kleine-König
2023-03-04 17:02   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 07/34] watchdog: bcm2835: " Uwe Kleine-König
2023-03-03 21:38   ` Florian Fainelli
2023-03-04 17:04   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 08/34] watchdog: bcm47xx: " Uwe Kleine-König
2023-03-04 17:01   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 09/34] watchdog: bcm_kona: " Uwe Kleine-König
2023-03-03 21:39   ` Florian Fainelli
2023-03-04 17:05   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 10/34] watchdog: cpwd: " Uwe Kleine-König
2023-03-04 17:05   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 11/34] watchdog: dw: " Uwe Kleine-König
2023-03-04 17:06   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 12/34] watchdog: gef: " Uwe Kleine-König
2023-03-04 17:06   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 13/34] watchdog: geodewdt: " Uwe Kleine-König
2023-03-04 17:07   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 14/34] watchdog: ib700wdt: " Uwe Kleine-König
2023-03-04 17:07   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 15/34] watchdog: ie6xx: " Uwe Kleine-König
2023-03-04 17:07   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 16/34] watchdog: lpc18xx: " Uwe Kleine-König
2023-03-04 17:08   ` Guenter Roeck
2023-03-03 21:36 ` [PATCH 17/34] watchdog: mtx-1: " Uwe Kleine-König
2023-03-04 17:09   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 18/34] watchdog: nic7018: " Uwe Kleine-König
2023-03-04 17:09   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 19/34] watchdog: nv_tco: " Uwe Kleine-König
2023-03-04 17:09   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 20/34] watchdog: omap: " Uwe Kleine-König
2023-03-04 17:09   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 21/34] watchdog: orion: " Uwe Kleine-König
2023-03-04 17:10   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 22/34] watchdog: rc32434: " Uwe Kleine-König
2023-03-04 17:10   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 23/34] watchdog: rdc321x: " Uwe Kleine-König
2023-03-04 17:10   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 24/34] watchdog: renesas: " Uwe Kleine-König
2023-03-04 17:10   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 25/34] watchdog: riowd: " Uwe Kleine-König
2023-03-04 17:10   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 26/34] watchdog: rn5t618: " Uwe Kleine-König
2023-03-04 17:12   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 27/34] watchdog: rti: " Uwe Kleine-König
2023-03-04 17:12   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 28/34] watchdog: s3c2410: " Uwe Kleine-König
2023-03-04 17:12   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 29/34] watchdog: sa1100: " Uwe Kleine-König
2023-03-04 17:13   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 30/34] watchdog: sch311x: " Uwe Kleine-König
2023-03-04 17:13   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 31/34] watchdog: shwdt: " Uwe Kleine-König
2023-03-04 17:13   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 32/34] watchdog: st_lpc: " Uwe Kleine-König
2023-03-04 17:13   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 33/34] watchdog: stmp3xxx_rtc: " Uwe Kleine-König
2023-03-04 17:14   ` Guenter Roeck
2023-03-03 21:37 ` [PATCH 34/34] watchdog: wm8350: " Uwe Kleine-König
2023-03-04 17:14   ` Guenter Roeck
2023-03-06 17:05 ` [PATCH 00/34] watchdog: " Uwe Kleine-König
2023-03-14  8:38 ` Naresh Kamboju

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).