mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] watchdog: restart handler: hang when watchdog cannot restart the machine
@ 2024-02-05 11:52 Sascha Hauer
  2024-02-08  7:10 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2024-02-05 11:52 UTC (permalink / raw)
  To: Barebox List

The __builtin_unreachable() in watchdog_restart_handle() is bogus,
because when the watchdog doesn't work we will run into
__builtin_unreachable() and behaviour is undefined. Drop the call
to __builtin_unreachable(), print a big fat warning and hang() the
machine which makes sure we don't return from watchdog_restart_handle().

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/watchdog/wd_core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
index 89e4f1d1ea..f39a8f4522 100644
--- a/drivers/watchdog/wd_core.c
+++ b/drivers/watchdog/wd_core.c
@@ -179,7 +179,9 @@ static void __noreturn watchdog_restart_handle(struct restart_handler *this)
 
 	BUG_ON(ret);
 	mdelay(2000);
-	__builtin_unreachable();
+
+	pr_emerg("Watchdog failed to reset the machine\n");
+	hang();
 }
 
 static struct restart_handler restart_handler = {
-- 
2.39.2




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

* Re: [PATCH] watchdog: restart handler: hang when watchdog cannot restart the machine
  2024-02-05 11:52 [PATCH] watchdog: restart handler: hang when watchdog cannot restart the machine Sascha Hauer
@ 2024-02-08  7:10 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-02-08  7:10 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer


On Mon, 05 Feb 2024 12:52:26 +0100, Sascha Hauer wrote:
> The __builtin_unreachable() in watchdog_restart_handle() is bogus,
> because when the watchdog doesn't work we will run into
> __builtin_unreachable() and behaviour is undefined. Drop the call
> to __builtin_unreachable(), print a big fat warning and hang() the
> machine which makes sure we don't return from watchdog_restart_handle().
> 
> 
> [...]

Applied, thanks!

[1/1] watchdog: restart handler: hang when watchdog cannot restart the machine
      https://git.pengutronix.de/cgit/barebox/commit/?id=ddf0d5cf35aa (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2024-02-08  7:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-05 11:52 [PATCH] watchdog: restart handler: hang when watchdog cannot restart the machine Sascha Hauer
2024-02-08  7:10 ` Sascha Hauer

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