Skip to contentSkip to conversation

power: reset: gpio-poweroff: Clarify the warning message

PATCH Applied Fabio Estevam 2 participants 2 messages Dec 12, 2024 System reset/shutdown drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: reset: gpio-poweroff: Clarify the warning message

When gpio-poweroff fails, a WARN_ON() is triggered without an explanation to the user about the failure.

Add some comments explaining that the attempt to poweroff the system via gpio-poweroff failed and convert it to a WARN() message with a bit of context to provide some hint to the user.

---
 drivers/power/reset/gpio-poweroff.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/power/reset/gpio-poweroff.c +7 -1
index 52cfeee2cb28..3eaae352ffb9 100644
@@ -44,7 +44,13 @@ static int gpio_poweroff_do_poweroff(struct sys_off_data *data)
 	/* give it some time */
 	mdelay(gpio_poweroff->timeout_ms);
 
-	WARN_ON(1);
+	/*
+	 * If code reaches this point, it means that gpio-poweroff has failed
+	 * to actually power off the system.
+	 * Warn the user that the attempt to poweroff via gpio-poweroff
+	 * has gone wrong.
+	 */
+	WARN(1, "Failed to poweroff via gpio-poweroff mechanism\n");
 
 	return NOTIFY_DONE;
 }
Signature · 1 line
2.34.1
#1 lore raw
Quoted 8 lines · Fabio Estevam

When gpio-poweroff fails, a WARN_ON() is triggered without an explanation to the user about the failure.

Add some comments explaining that the attempt to poweroff the system via gpio-poweroff failed and convert it to a WARN() message with a bit of context to provide some hint to the user.

[...]

Applied, thanks!

[1/1] power: reset: gpio-poweroff: Clarify the warning message

      commit: 8a1c099f36b256c8203319313f65666ce0043fe5

Best regards,

Signature · 1 line
Sebastian Reichel <[email protected]>