Skip to contentSkip to conversation

watchdog: sprd_wdt: Remove redundant sprd_wdt_disable() on register failure

PATCH In review Felix Gu 3 participants 6 messages Feb 23 – May 24

Subsystems (2)
lore
Share & tools
lore

Felix Gu

author
#0 lore raw

PATCH 1/1 watchdog: sprd_wdt: Remove redundant sprd_wdt_disable() on register failure

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")
---
 drivers/watchdog/sprd_wdt.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/watchdog/sprd_wdt.c +2 -3
index 4e689b6ff141..aacf04616fef 100644
@@ -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,

Signature · 1 line
Felix Gu <[email protected]>
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · 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")
Reviewed-by on v1 1/1
#2 lore raw
In reply to Felix Gu
Quoted 11 lines · 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")

Good catch. Thanks.

Quoted 27 lines
---
  drivers/watchdog/sprd_wdt.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
drivers/watchdog/sprd_wdt.c +2 -4
index 4e689b6ff141..aacf04616fef 100644
@@ -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,

author
#3 lore raw

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

Best Felix

maintainer
#4 lore raw
Quoted 5 lines · Felix Gu

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

author
#5 lore raw
Quoted 11 lines · Guenter Roeck
Quoted 5 lines · Felix Gu

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

Quoted 2 lines

Guenter