diff mbox series

[28/34] watchdog: s3c2410: Convert to platform remove callback returning void

Message ID 20230303213716.2123717-29-u.kleine-koenig@pengutronix.de (mailing list archive)
State New
Headers show
Series watchdog: Convert to platform remove callback returning void | expand

Commit Message

Uwe Kleine-König March 3, 2023, 9:37 p.m. UTC
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(-)

Comments

Guenter Roeck March 4, 2023, 5:12 p.m. UTC | #1
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
>
diff mbox series

Patch

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		= {