[PATCH v2 8/9] watchdog: msc313e: Propagate error code in resume()
From: Tzung-Bi Shih
Date: Fri Aug 28 2026 - 12:20:07 EST
If msc313e_wdt_start() fails during system resume, the error is
currently ignored. Consequently, the watchdog isn't running without the
user's knowledge.
Propagate the error code, print a message, and explicitly clear both the
WDOG_HW_RUNNING and WDOG_ACTIVE flags if start fails.
Signed-off-by: Tzung-Bi Shih <tzungbi@xxxxxxxxxx>
---
v2:
- New to the series.
---
drivers/watchdog/msc313e_wdt.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/watchdog/msc313e_wdt.c b/drivers/watchdog/msc313e_wdt.c
index 4a5cce2a16b1..6af865750ad0 100644
--- a/drivers/watchdog/msc313e_wdt.c
+++ b/drivers/watchdog/msc313e_wdt.c
@@ -191,11 +191,19 @@ static int __maybe_unused msc313e_wdt_suspend(struct device *dev)
static int __maybe_unused msc313e_wdt_resume(struct device *dev)
{
struct msc313e_wdt_priv *priv = dev_get_drvdata(dev);
+ int ret = 0;
- if (watchdog_active(&priv->wdev) || watchdog_hw_running(&priv->wdev))
- msc313e_wdt_start(&priv->wdev);
+ if (watchdog_active(&priv->wdev) || watchdog_hw_running(&priv->wdev)) {
+ ret = msc313e_wdt_start(&priv->wdev);
+ if (ret) {
+ dev_err(dev, "Failed to restart watchdog (err=%d)\n", ret);
- return 0;
+ clear_bit(WDOG_HW_RUNNING, &priv->wdev.status);
+ clear_bit(WDOG_ACTIVE, &priv->wdev.status);
+ }
+ }
+
+ return ret;
}
static SIMPLE_DEV_PM_OPS(msc313e_wdt_pm_ops, msc313e_wdt_suspend, msc313e_wdt_resume);
--
2.53.0