Commit afacb218 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Lee Jones

leds: trigger: panic: Don't register panic notifier if creating the trigger failed

It doesn't make sense to register the panic notifier if creating the
panic trigger failed.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/8a61e229-5388-46c7-919a-4d18cc7362b2@gmail.comSigned-off-by: default avatarLee Jones <lee@kernel.org>
parent 06c5206c
......@@ -64,10 +64,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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment