Re: [PATCH v0 35/42] sh: Check notifier registration return value

From: Sergey Shtylyov
Date: Mon Nov 08 2021 - 09:48:30 EST


On 08.11.2021 13:11, Borislav Petkov wrote:

From: Borislav Petkov <bp@xxxxxxx>

Avoid homegrown notifier registration checks.

No functional changes.

Signed-off-by: Borislav Petkov <bp@xxxxxxx>
Cc: linux-sh@xxxxxxxxxxxxxxx
---
arch/sh/kernel/cpu/sh4a/setup-sh7724.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
index 0d990ab1ba2a..8dfbb8149f66 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
@@ -1277,11 +1277,14 @@ static struct notifier_block sh7724_post_sleep_notifier = {
static int __init sh7724_sleep_setup(void)
{
- atomic_notifier_chain_register(&sh_mobile_pre_sleep_notifier_list,
- &sh7724_pre_sleep_notifier);
+ if (atomic_notifier_chain_register(&sh_mobile_pre_sleep_notifier_list,
+ &sh7724_pre_sleep_notifier))
+ pr_warn("SH7724 pre-sleep notifier already registered\n");
+
+ if (atomic_notifier_chain_register(&sh_mobile_post_sleep_notifier_list,
+ &sh7724_post_sleep_notifier))
+ pr_warn("SH7724 pre-sleep notifier already registered\n");

s/pre/post/? :-)

- atomic_notifier_chain_register(&sh_mobile_post_sleep_notifier_list,
- &sh7724_post_sleep_notifier);
return 0;
}
arch_initcall(sh7724_sleep_setup);

MBR, Sergey