From: Borislav Petkov <bp@alien8.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: linux-mips@vger.kernel.org
Subject: [PATCH v0 33/42] mips: Check notifier registration return value
Date: Mon, 8 Nov 2021 11:11:48 +0100 [thread overview]
Message-ID: <20211108101157.15189-34-bp@alien8.de> (raw)
In-Reply-To: <20211108101157.15189-1-bp@alien8.de>
From: Borislav Petkov <bp@suse.de>
Avoid homegrown notifier registration checks.
No functional changes.
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: linux-mips@vger.kernel.org
---
arch/mips/kernel/relocate.c | 6 ++++--
arch/mips/sgi-ip22/ip22-reset.c | 4 +++-
arch/mips/sgi-ip32/ip32-reset.c | 4 +++-
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c
index 56b51de2dc51..d577654242da 100644
--- a/arch/mips/kernel/relocate.c
+++ b/arch/mips/kernel/relocate.c
@@ -459,8 +459,10 @@ static struct notifier_block kernel_location_notifier = {
static int __init register_kernel_offset_dumper(void)
{
- atomic_notifier_chain_register(&panic_notifier_list,
- &kernel_location_notifier);
+ if (atomic_notifier_chain_register(&panic_notifier_list,
+ &kernel_location_notifier))
+ pr_warn("Kernel location notifier already registered\n");
+
return 0;
}
__initcall(register_kernel_offset_dumper);
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
index 9028dbbb45dd..841fd31cac03 100644
--- a/arch/mips/sgi-ip22/ip22-reset.c
+++ b/arch/mips/sgi-ip22/ip22-reset.c
@@ -196,7 +196,9 @@ static int __init reboot_setup(void)
}
timer_setup(&blink_timer, blink_timeout, 0);
- atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
+
+ if (atomic_notifier_chain_register(&panic_notifier_list, &panic_block))
+ pr_warn("Panic notifier already registered\n");
return 0;
}
diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c
index 18d1c115cd53..bdad9213f81b 100644
--- a/arch/mips/sgi-ip32/ip32-reset.c
+++ b/arch/mips/sgi-ip32/ip32-reset.c
@@ -145,7 +145,9 @@ static __init int ip32_reboot_setup(void)
pm_power_off = ip32_machine_halt;
timer_setup(&blink_timer, blink_timeout, 0);
- atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
+
+ if (atomic_notifier_chain_register(&panic_notifier_list, &panic_block))
+ pr_warn("Panic notifier already registered\n");
return 0;
}
--
2.29.2
next parent reply other threads:[~2021-11-08 10:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20211108101157.15189-1-bp@alien8.de>
2021-11-08 10:11 ` Borislav Petkov [this message]
2021-11-08 10:11 ` [PATCH v0 42/42] notifier: Return an error when callback is already registered Borislav Petkov
2021-11-08 14:07 ` Geert Uytterhoeven
2021-11-08 14:21 ` Borislav Petkov
2021-11-08 15:25 ` Geert Uytterhoeven
2021-11-08 15:58 ` Borislav Petkov
2021-11-08 16:12 ` Geert Uytterhoeven
2021-11-08 16:21 ` Borislav Petkov
2021-11-08 20:59 ` Alan Stern
2021-11-08 21:18 ` Borislav Petkov
2021-11-08 10:19 ` [PATCH v0 00/42] notifiers: " Borislav Petkov
2021-11-08 14:17 ` Alan Stern
2021-11-08 14:24 ` Borislav Petkov
2021-11-08 14:35 ` Borislav Petkov
2021-11-08 16:23 ` Steven Rostedt
2021-11-08 16:29 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211108101157.15189-34-bp@alien8.de \
--to=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox