mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master 1/2] sandbox: watchdog: don't return positive values from set_timeout
@ 2021-04-26 11:34 Ahmad Fatoum
  2021-04-26 11:34 ` [PATCH master 2/2] Documentation: user: watchdog: sync with current state Ahmad Fatoum
  2021-05-03 10:38 ` [PATCH master 1/2] sandbox: watchdog: don't return positive values from set_timeout Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2021-04-26 11:34 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

linux_watchdog_set_timeout() does return alarm(), which can never fail
and returns either zero or a positive value.

watchdog::set_timeout on the other hand should return either 0 or
a negative number on error.

Ignore linux_watchdog_set_timeout()'s return value, so
watchdog_set_timeout propagates the correct value.

This fixes an issue where seconds_to_expire wasn't updated on
subsequent pings of this watchdog.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/sandbox/board/watchdog.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/sandbox/board/watchdog.c b/arch/sandbox/board/watchdog.c
index 336451282fd3..e1cff7a0bf0b 100644
--- a/arch/sandbox/board/watchdog.c
+++ b/arch/sandbox/board/watchdog.c
@@ -29,7 +29,8 @@ static int sandbox_watchdog_set_timeout(struct watchdog *wdd, unsigned int timeo
 	if (timeout > wdd->timeout_max)
 		return -EINVAL;
 
-	return linux_watchdog_set_timeout(timeout);
+	linux_watchdog_set_timeout(timeout);
+	return 0;
 }
 
 static int sandbox_watchdog_probe(struct device_d *dev)
-- 
2.29.2


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


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

end of thread, other threads:[~2021-05-03 10:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26 11:34 [PATCH master 1/2] sandbox: watchdog: don't return positive values from set_timeout Ahmad Fatoum
2021-04-26 11:34 ` [PATCH master 2/2] Documentation: user: watchdog: sync with current state Ahmad Fatoum
2021-05-03 10:38 ` [PATCH master 1/2] sandbox: watchdog: don't return positive values from set_timeout Sascha Hauer

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