[PATCH v0 10/42] leds: trigger: Check notifier registration return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Borislav Petkov <bp@xxxxxxx>

Avoid homegrown notifier registration checks.

No functional changes.

Signed-off-by: Borislav Petkov <bp@xxxxxxx>
Cc: linux-leds@xxxxxxxxxxxxxxx
---
 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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux