mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] watchdog: sprd_wdt: Remove redundant sprd_wdt_disable() on register failure
@ 2026-02-23 11:59 Felix Gu
  2026-02-23 15:09 ` Guenter Roeck
  2026-02-24  1:30 ` Baolin Wang
  0 siblings, 2 replies; 6+ messages in thread
From: Felix Gu @ 2026-02-23 11:59 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-watchdog, linux-kernel, Felix Gu

The driver uses devm_add_action_or_reset() to register sprd_wdt_disable()
as a managed cleanup action.

When devm_watchdog_register_device() fails, the devm core will invoke
the cleanup action automatically.

The explicit sprd_wdt_disable() call in the error path is therefore
redundant and results in adouble cleanup.

Fixes: 78d9bfad2e89 ("watchdog: sprd_wdt: Convert to use device managed functions and other improvements")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/watchdog/sprd_wdt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/watchdog/sprd_wdt.c b/drivers/watchdog/sprd_wdt.c
index 4e689b6ff141..aacf04616fef 100644
--- a/drivers/watchdog/sprd_wdt.c
+++ b/drivers/watchdog/sprd_wdt.c
@@ -320,10 +320,9 @@ static int sprd_wdt_probe(struct platform_device *pdev)
 	watchdog_init_timeout(&wdt->wdd, 0, dev);
 
 	ret = devm_watchdog_register_device(dev, &wdt->wdd);
-	if (ret) {
-		sprd_wdt_disable(wdt);
+	if (ret)
 		return ret;
-	}
+
 	platform_set_drvdata(pdev, wdt);
 
 	return 0;

---
base-commit: d4906ae14a5f136ceb671bb14cedbf13fa560da6
change-id: 20260223-sprd_wdt-3e7ec7187f30

Best regards,
-- 
Felix Gu <ustc.gu@gmail.com>


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

* Re: [PATCH] watchdog: sprd_wdt: Remove redundant sprd_wdt_disable() on register failure
  2026-02-23 11:59 [PATCH] watchdog: sprd_wdt: Remove redundant sprd_wdt_disable() on register failure Felix Gu
@ 2026-02-23 15:09 ` Guenter Roeck
  2026-02-24  1:30 ` Baolin Wang
  1 sibling, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2026-02-23 15:09 UTC (permalink / raw)
  To: Felix Gu, Wim Van Sebroeck, Orson Zhai, Baolin Wang, Chunyan Zhang
  Cc: linux-watchdog, linux-kernel

On 2/23/26 03:59, Felix Gu wrote:
> The driver uses devm_add_action_or_reset() to register sprd_wdt_disable()
> as a managed cleanup action.
> 
> When devm_watchdog_register_device() fails, the devm core will invoke
> the cleanup action automatically.
> 
> The explicit sprd_wdt_disable() call in the error path is therefore
> redundant and results in adouble cleanup.
> 
> Fixes: 78d9bfad2e89 ("watchdog: sprd_wdt: Convert to use device managed functions and other improvements")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>


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

* Re: [PATCH] watchdog: sprd_wdt: Remove redundant sprd_wdt_disable() on register failure
  2026-02-23 11:59 [PATCH] watchdog: sprd_wdt: Remove redundant sprd_wdt_disable() on register failure Felix Gu
  2026-02-23 15:09 ` Guenter Roeck
@ 2026-02-24  1:30 ` Baolin Wang
  2026-05-24  6:04   ` Felix Gu
  1 sibling, 1 reply; 6+ messages in thread
From: Baolin Wang @ 2026-02-24  1:30 UTC (permalink / raw)
  To: Felix Gu, Wim Van Sebroeck, Guenter Roeck, Orson Zhai, Chunyan Zhang
  Cc: linux-watchdog, linux-kernel



On 2/23/26 7:59 PM, Felix Gu wrote:
> The driver uses devm_add_action_or_reset() to register sprd_wdt_disable()
> as a managed cleanup action.
> 
> When devm_watchdog_register_device() fails, the devm core will invoke
> the cleanup action automatically.
> 
> The explicit sprd_wdt_disable() call in the error path is therefore
> redundant and results in adouble cleanup.
> 
> Fixes: 78d9bfad2e89 ("watchdog: sprd_wdt: Convert to use device managed functions and other improvements")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>

Good catch. Thanks.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>

> ---
>   drivers/watchdog/sprd_wdt.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/sprd_wdt.c b/drivers/watchdog/sprd_wdt.c
> index 4e689b6ff141..aacf04616fef 100644
> --- a/drivers/watchdog/sprd_wdt.c
> +++ b/drivers/watchdog/sprd_wdt.c
> @@ -320,10 +320,9 @@ static int sprd_wdt_probe(struct platform_device *pdev)
>   	watchdog_init_timeout(&wdt->wdd, 0, dev);
>   
>   	ret = devm_watchdog_register_device(dev, &wdt->wdd);
> -	if (ret) {
> -		sprd_wdt_disable(wdt);
> +	if (ret)
>   		return ret;
> -	}
> +
>   	platform_set_drvdata(pdev, wdt);
>   
>   	return 0;
> 
> ---
> base-commit: d4906ae14a5f136ceb671bb14cedbf13fa560da6
> change-id: 20260223-sprd_wdt-3e7ec7187f30
> 
> Best regards,


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

* Re: [PATCH] watchdog: sprd_wdt: Remove redundant sprd_wdt_disable() on register failure
  2026-02-24  1:30 ` Baolin Wang
@ 2026-05-24  6:04   ` Felix Gu
  2026-05-24 14:00     ` Guenter Roeck
  0 siblings, 1 reply; 6+ messages in thread
From: Felix Gu @ 2026-05-24  6:04 UTC (permalink / raw)
  To: Baolin Wang
  Cc: Wim Van Sebroeck, Guenter Roeck, Orson Zhai, Chunyan Zhang,
	linux-watchdog, linux-kernel

Hi Guenter,
Gentle ping.
Is it good to merge?

Best Felix

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

* Re: [PATCH] watchdog: sprd_wdt: Remove redundant sprd_wdt_disable() on register failure
  2026-05-24  6:04   ` Felix Gu
@ 2026-05-24 14:00     ` Guenter Roeck
  2026-05-24 17:05       ` Felix Gu
  0 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2026-05-24 14:00 UTC (permalink / raw)
  To: Felix Gu, Baolin Wang
  Cc: Wim Van Sebroeck, Orson Zhai, Chunyan Zhang, linux-watchdog,
	linux-kernel

On 5/23/26 23:04, Felix Gu wrote:
> Hi Guenter,
> Gentle ping.
> Is it good to merge?
> 
> Best Felix

I checked. The patch is queued in my watchdog-next, and I just confirmed
that it is in linux-next (next-20260522). What else are you looking for ?

Guenter


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

* Re: [PATCH] watchdog: sprd_wdt: Remove redundant sprd_wdt_disable() on register failure
  2026-05-24 14:00     ` Guenter Roeck
@ 2026-05-24 17:05       ` Felix Gu
  0 siblings, 0 replies; 6+ messages in thread
From: Felix Gu @ 2026-05-24 17:05 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Baolin Wang, Wim Van Sebroeck, Orson Zhai, Chunyan Zhang,
	linux-watchdog, linux-kernel

On Sun, May 24, 2026 at 10:00 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> On 5/23/26 23:04, Felix Gu wrote:
> > Hi Guenter,
> > Gentle ping.
> > Is it good to merge?
> >
> > Best Felix
>
> I checked. The patch is queued in my watchdog-next, and I just confirmed
> that it is in linux-next (next-20260522). What else are you looking for ?
>
Hi Guenter,
Thanks.
I didn't notice it was already in the linux-next.

Best regards,
Felix

> Guenter
>

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

end of thread, other threads:[~2026-05-24 17:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-23 11:59 [PATCH] watchdog: sprd_wdt: Remove redundant sprd_wdt_disable() on register failure Felix Gu
2026-02-23 15:09 ` Guenter Roeck
2026-02-24  1:30 ` Baolin Wang
2026-05-24  6:04   ` Felix Gu
2026-05-24 14:00     ` Guenter Roeck
2026-05-24 17:05       ` Felix Gu

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

all inboxes | Powered by JetHome®