summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-08-19 11:02:31 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-08-20 14:04:06 +0200
commit10948f86a3c50d97aecf6544cba8fd6ee114b095 (patch)
treeaf59ce41d5f2dfe037bdaaa8dadd90b1c7892fab /drivers/watchdog
parent52dafe3eb5f2b5f5e695bb2a8485610b33285871 (diff)
downloadbarebox-10948f86a3c50d97aecf6544cba8fd6ee114b095.tar.gz
barebox-10948f86a3c50d97aecf6544cba8fd6ee114b095.tar.xz
watchdog: fix watchdog_set_timeout breakage for drivers like imxwd
Commit 0b944fce55f4 ("watchdog: permit `wd 0` for non-stoppable, but inactive, watchdogs") silently broke use of watchdogs, that report being inactive at driver probe time, altogether. Because those always had watchdog_hw_running evaluating to false, it early exited without a chance to ever actually set the timeout (and for watchdog_hw_running to evaluate to != false). This results in following watchdog drivers being broken in v2020.08.0: - imxwd - f71808e_wdt - at91sam9_wdt Fixes: 0b944fce55f4 ("watchdog: permit `wd 0` for non-stoppable, but inactive, watchdogs") Reported-by: Bastian Krause <bst@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/wd_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
index ab1dcaa40a..665338af61 100644
--- a/drivers/watchdog/wd_core.c
+++ b/drivers/watchdog/wd_core.c
@@ -45,7 +45,7 @@ int watchdog_set_timeout(struct watchdog *wd, unsigned timeout)
if (timeout > wd->timeout_max)
return -EINVAL;
- if (watchdog_hw_running(wd) == false)
+ if (!timeout && !watchdog_hw_running(wd))
return 0;
pr_debug("setting timeout on %s to %ds\n", watchdog_name(wd), timeout);