[PATCH v0 31/42] parisc: Check notifier registration return value
From: Borislav Petkov
Date: Mon Nov 08 2021 - 05:16:44 EST
From: Borislav Petkov <bp@xxxxxxx>
Avoid homegrown notifier registration checks.
No functional changes.
Signed-off-by: Borislav Petkov <bp@xxxxxxx>
Cc: linux-parisc@xxxxxxxxxxxxxxx
---
arch/parisc/kernel/pdc_chassis.c | 5 +++--
drivers/parisc/power.c | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/parisc/kernel/pdc_chassis.c b/arch/parisc/kernel/pdc_chassis.c
index da154406d368..8bedc9faa791 100644
--- a/arch/parisc/kernel/pdc_chassis.c
+++ b/arch/parisc/kernel/pdc_chassis.c
@@ -135,8 +135,9 @@ void __init parisc_pdc_chassis_init(void)
PDC_CHASSIS_VER);
/* initialize panic notifier chain */
- atomic_notifier_chain_register(&panic_notifier_list,
- &pdc_chassis_panic_block);
+ if (atomic_notifier_chain_register(&panic_notifier_list,
+ &pdc_chassis_panic_block))
+ printk(KERN_WARNING "Panic notifier already registered\n");
/* initialize reboot notifier chain */
register_reboot_notifier(&pdc_chassis_reboot_block);
diff --git a/drivers/parisc/power.c b/drivers/parisc/power.c
index 456776bd8ee6..26dabaa1e5f8 100644
--- a/drivers/parisc/power.c
+++ b/drivers/parisc/power.c
@@ -230,8 +230,9 @@ static int __init power_init(void)
}
/* Register a call for panic conditions. */
- atomic_notifier_chain_register(&panic_notifier_list,
- &parisc_panic_block);
+
+ if (atomic_notifier_chain_register(&panic_notifier_list, &parisc_panic_block))
+ pr_warn("Panic notifier already registered\n");
return 0;
}
--
2.29.2