linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Wim Van Sebroeck <wim@linux-watchdog.org>,
	patches@opensource.cirrus.com, linux-watchdog@vger.kernel.org,
	kernel@pengutronix.de
Subject: Re: [PATCH 34/34] watchdog: wm8350: Convert to platform remove callback returning void
Date: Sat, 4 Mar 2023 09:14:57 -0800	[thread overview]
Message-ID: <7db0e8ab-5fd2-416d-a4c7-579249aded2a@roeck-us.net> (raw)
In-Reply-To: <20230303213716.2123717-35-u.kleine-koenig@pengutronix.de>

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
> 

  reply	other threads:[~2023-03-04 17:15 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2023-03-06 17:05 ` [PATCH 00/34] watchdog: " Uwe Kleine-König
2023-03-14  8:38 ` Naresh Kamboju

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7db0e8ab-5fd2-416d-a4c7-579249aded2a@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=kernel@pengutronix.de \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).