diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2023-12-16 21:05:33 +0100 |
---|---|---|
committer | Lee Jones <lee@kernel.org> | 2023-12-21 14:54:45 +0000 |
commit | afacb21834bb02785ddb0c3ec197208803b74faa (patch) | |
tree | 3fcfe6ef351543a16b1cbe8f85f50733687bfe4d | |
parent | 06c5206ccdb459de95bb8d558602d2a722dd4bbc (diff) |
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: 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>
-rw-r--r-- | drivers/leds/trigger/ledtrig-panic.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/leds/trigger/ledtrig-panic.c b/drivers/leds/trigger/ledtrig-panic.c index 64abf2e91608..5a6b21bfeb9a 100644 --- a/drivers/leds/trigger/ledtrig-panic.c +++ b/drivers/leds/trigger/ledtrig-panic.c @@ -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; } |