From ddf0d5cf35aa5e5e13a3e3a09ea5eea997dcbbd8 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Mon, 5 Feb 2024 12:52:26 +0100 Subject: watchdog: restart handler: hang when watchdog cannot restart the machine 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(). Link: https://lore.barebox.org/20240205115226.2432028-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer --- drivers/watchdog/wd_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/watchdog') 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 = { -- cgit v1.2.3