mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2] watchdog: fix watchdog_set_timeout breakage for drivers like imxwd
@ 2020-08-19  9:02 Ahmad Fatoum
  2020-08-20 12:04 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2020-08-19  9:02 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum, Bastian Krause

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>
---
v1 -> v2:
 - made commit message about scope of breakage more accurate
 - moved check back to top, but in fixed form, as suggested by Sascha
---
 drivers/watchdog/wd_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
index ab1dcaa40a3a..665338af6197 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);
-- 
2.28.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2020-08-20 12:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19  9:02 [PATCH v2] watchdog: fix watchdog_set_timeout breakage for drivers like imxwd Ahmad Fatoum
2020-08-20 12:04 ` Sascha Hauer

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