[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211108101157.15189-11-bp@alien8.de>
Date: Mon, 8 Nov 2021 11:11:25 +0100
From: Borislav Petkov <bp@...en8.de>
To: LKML <linux-kernel@...r.kernel.org>
Cc: linux-leds@...r.kernel.org
Subject: [PATCH v0 10/42] leds: trigger: Check notifier registration return value
From: Borislav Petkov <bp@...e.de>
Avoid homegrown notifier registration checks.
No functional changes.
Signed-off-by: Borislav Petkov <bp@...e.de>
Cc: linux-leds@...r.kernel.org
---
drivers/leds/trigger/ledtrig-activity.c | 6 ++++--
drivers/leds/trigger/ledtrig-heartbeat.c | 6 ++++--
drivers/leds/trigger/ledtrig-panic.c | 4 ++--
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/leds/trigger/ledtrig-activity.c b/drivers/leds/trigger/ledtrig-activity.c
index 30bc9df03636..c2b7a3d322f3 100644
--- a/drivers/leds/trigger/ledtrig-activity.c
+++ b/drivers/leds/trigger/ledtrig-activity.c
@@ -247,8 +247,10 @@ static int __init activity_init(void)
int rc = led_trigger_register(&activity_led_trigger);
if (!rc) {
- atomic_notifier_chain_register(&panic_notifier_list,
- &activity_panic_nb);
+ if (atomic_notifier_chain_register(&panic_notifier_list,
+ &activity_panic_nb))
+ pr_warn("Activity LED trigger notifier already registered\n");
+
register_reboot_notifier(&activity_reboot_nb);
}
return rc;
diff --git a/drivers/leds/trigger/ledtrig-heartbeat.c b/drivers/leds/trigger/ledtrig-heartbeat.c
index 7fe0a05574d2..747c5113d528 100644
--- a/drivers/leds/trigger/ledtrig-heartbeat.c
+++ b/drivers/leds/trigger/ledtrig-heartbeat.c
@@ -190,8 +190,10 @@ static int __init heartbeat_trig_init(void)
int rc = led_trigger_register(&heartbeat_led_trigger);
if (!rc) {
- atomic_notifier_chain_register(&panic_notifier_list,
- &heartbeat_panic_nb);
+ if (atomic_notifier_chain_register(&panic_notifier_list,
+ &heartbeat_panic_nb))
+ pr_warn("Heartbeat LED Trigger notifier already registered\n");
+
register_reboot_notifier(&heartbeat_reboot_nb);
}
return rc;
diff --git a/drivers/leds/trigger/ledtrig-panic.c b/drivers/leds/trigger/ledtrig-panic.c
index 64abf2e91608..c5103f51c3de 100644
--- a/drivers/leds/trigger/ledtrig-panic.c
+++ b/drivers/leds/trigger/ledtrig-panic.c
@@ -64,8 +64,8 @@ static long led_panic_blink(int state)
static int __init ledtrig_panic_init(void)
{
- atomic_notifier_chain_register(&panic_notifier_list,
- &led_trigger_panic_nb);
+ if (atomic_notifier_chain_register(&panic_notifier_list, &led_trigger_panic_nb))
+ pr_warn("LED trigger panic notifier already registered\n");
led_trigger_register_simple("panic", &trigger);
panic_blink = led_panic_blink;
--
2.29.2
Powered by blists - more mailing lists