[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240124142949.1283818-1-sashal@kernel.org>
Date: Wed, 24 Jan 2024 09:29:31 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Cc: Heiner Kallweit <hkallweit1@...il.com>,
Lee Jones <lee@...nel.org>,
Sasha Levin <sashal@...nel.org>,
pavel@....cz,
linux-leds@...r.kernel.org
Subject: [PATCH AUTOSEL 6.1 1/9] leds: trigger: panic: Don't register panic notifier if creating the trigger failed
From: Heiner Kallweit <hkallweit1@...il.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@...il.com>
Link: https://lore.kernel.org/r/8a61e229-5388-46c7-919a-4d18cc7362b2@gmail.com
Signed-off-by: Lee Jones <lee@...nel.org>
Signed-off-by: Sasha Levin <sashal@...nel.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 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;
}
--
2.43.0
Powered by blists - more mailing lists