diff mbox series

[v5,4/6] kernel/reboot: sys_off_notify: always return NOTIFY_DONE

Message ID 20230327-tegra-pmic-reboot-v5-4-ab090e03284d@skidata.com
State Handled Elsewhere
Headers show
Series mfd: tps6586x: register restart handler | expand

Commit Message

Benjamin Bara April 18, 2023, 11:10 a.m. UTC
From: Benjamin Bara <benjamin.bara@skidata.com>

A failed sys_off_handler should not be able to skip other registered
handlers. Therefore, report the error but always return NOTIFY_DONE, to
indicate that atomic_notifier_call_chain() should continue.

Signed-off-by: Benjamin Bara <benjamin.bara@skidata.com>
---
 kernel/reboot.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel/reboot.c b/kernel/reboot.c
index 395a0ea3c7a8..689a147bc1dc 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -320,6 +320,7 @@  static int sys_off_notify(struct notifier_block *nb,
 {
 	struct sys_off_handler *handler;
 	struct sys_off_data data = {};
+	int ret;
 
 	handler = container_of(nb, struct sys_off_handler, nb);
 	data.cb_data = handler->cb_data;
@@ -327,7 +328,11 @@  static int sys_off_notify(struct notifier_block *nb,
 	data.cmd = cmd;
 	data.dev = handler->dev;
 
-	return handler->sys_off_cb(&data);
+	ret = handler->sys_off_cb(&data);
+	if (ret != NOTIFY_DONE)
+		dev_err(handler->dev, "sys_off_handler failed: %d\n", notifier_to_errno(ret));
+
+	return NOTIFY_DONE;
 }
 
 static struct sys_off_handler platform_sys_off_handler;