From 1c81d4a5cda2381dd764e418bdf5d15fbe62b588 Mon Sep 17 00:00:00 2001 From: Li Jun Date: Fri, 11 Sep 2026 11:05:31 +0800 Subject: [PATCH] watchdog: sp805_wdt: fix suspend/resume handling of HW_RUNNING watchdog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sp805_wdt_suspend() and sp805_wdt_resume() only check watchdog_active(), when the watchdog is left running by the driver sets WDOG_HW_RUNNING in sp805_wdt_probe() but userspace never opens the device, so WDOG_ACTIVE remains cleared, the wdt_disable() will not be executed in sp805_wdt_suspend. In this case, the suspend callback is a no-op and the watchdog keeps counting during system suspend, leading to an unexpected system reset. Check WDOG_HW_RUNNING and wdt->wdd,can fix this issue. Signed-off-by: Li Jun Link: https://patch.msgid.link/20260911030531.837140-1-lijun01@kylinos.cn Signed-off-by: Guenter Roeck --- drivers/watchdog/sp805_wdt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c index 7b01011a5bc8..925f12157181 100644 --- a/drivers/watchdog/sp805_wdt.c +++ b/drivers/watchdog/sp805_wdt.c @@ -325,7 +325,8 @@ static int sp805_wdt_suspend(struct device *dev) { struct sp805_wdt *wdt = dev_get_drvdata(dev); - if (watchdog_active(&wdt->wdd)) + if (watchdog_active(&wdt->wdd) || + watchdog_hw_running(&wdt->wdd)) return wdt_disable(&wdt->wdd); return 0; @@ -335,7 +336,8 @@ static int sp805_wdt_resume(struct device *dev) { struct sp805_wdt *wdt = dev_get_drvdata(dev); - if (watchdog_active(&wdt->wdd)) + if (watchdog_active(&wdt->wdd) || + watchdog_hw_running(&wdt->wdd)) return wdt_enable(&wdt->wdd); return 0;