public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.4 1/6] leds: trigger: panic: Don't register panic notifier if creating the trigger failed
@ 2024-01-24 14:31 Sasha Levin
  2024-01-24 14:31 ` [PATCH AUTOSEL 5.4 2/6] um: Fix naming clash between UML and scheduler Sasha Levin
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Sasha Levin @ 2024-01-24 14:31 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Heiner Kallweit, Lee Jones, Sasha Levin, pavel, linux-leds

From: Heiner Kallweit <hkallweit1@gmail.com>

[ Upstream commit afacb21834bb02785ddb0c3ec197208803b74faa ]

It doesn't make sense to register the panic notifier if creating the
panic trigger failed.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/8a61e229-5388-46c7-919a-4d18cc7362b2@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/leds/trigger/ledtrig-panic.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/trigger/ledtrig-panic.c b/drivers/leds/trigger/ledtrig-panic.c
index 5751cd032f9d..4bf232465dfd 100644
--- a/drivers/leds/trigger/ledtrig-panic.c
+++ b/drivers/leds/trigger/ledtrig-panic.c
@@ -63,10 +63,13 @@ static long led_panic_blink(int state)
 
 static int __init ledtrig_panic_init(void)
 {
+	led_trigger_register_simple("panic", &trigger);
+	if (!trigger)
+		return -ENOMEM;
+
 	atomic_notifier_chain_register(&panic_notifier_list,
 				       &led_trigger_panic_nb);
 
-	led_trigger_register_simple("panic", &trigger);
 	panic_blink = led_panic_blink;
 	return 0;
 }
-- 
2.43.0


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

end of thread, other threads:[~2024-01-24 14:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-24 14:31 [PATCH AUTOSEL 5.4 1/6] leds: trigger: panic: Don't register panic notifier if creating the trigger failed Sasha Levin
2024-01-24 14:31 ` [PATCH AUTOSEL 5.4 2/6] um: Fix naming clash between UML and scheduler Sasha Levin
2024-01-24 14:31 ` [PATCH AUTOSEL 5.4 3/6] um: Don't use vfprintf() for os_info() Sasha Levin
2024-01-24 14:31 ` [PATCH AUTOSEL 5.4 4/6] um: net: Fix return type of uml_net_start_xmit() Sasha Levin
2024-01-24 14:31 ` [PATCH AUTOSEL 5.4 5/6] i3c: master: cdns: Update maximum prescaler value for i2c clock Sasha Levin
2024-01-24 14:31 ` [PATCH AUTOSEL 5.4 6/6] mfd: ti_am335x_tscadc: Fix TI SoC dependencies Sasha Levin

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