diff mbox series

[v0,14/42] remoteproc: Check notifier registration return value

Message ID 20211108101157.15189-15-bp@alien8.de (mailing list archive)
State Rejected
Headers show
Series None | expand

Commit Message

Borislav Petkov Nov. 8, 2021, 10:11 a.m. UTC
From: Borislav Petkov <bp@suse.de>

Avoid homegrown notifier registration checks.

No functional changes.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: linux-remoteproc@vger.kernel.org
---
 drivers/remoteproc/qcom_common.c     | 3 ++-
 drivers/remoteproc/qcom_sysmon.c     | 4 +++-
 drivers/remoteproc/remoteproc_core.c | 4 +++-
 3 files changed, 8 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
index 4b91e3c9eafa..61a7812fe4df 100644
--- a/drivers/remoteproc/qcom_common.c
+++ b/drivers/remoteproc/qcom_common.c
@@ -390,7 +390,8 @@  void *qcom_register_ssr_notifier(const char *name, struct notifier_block *nb)
 	if (IS_ERR(info))
 		return info;
 
-	srcu_notifier_chain_register(&info->notifier_list, nb);
+	if (srcu_notifier_chain_register(&info->notifier_list, nb))
+		pr_warn("SSR notifier already registered\n");
 
 	return &info->notifier_list;
 }
diff --git a/drivers/remoteproc/qcom_sysmon.c b/drivers/remoteproc/qcom_sysmon.c
index 9fca81492863..ffe7811f8aac 100644
--- a/drivers/remoteproc/qcom_sysmon.c
+++ b/drivers/remoteproc/qcom_sysmon.c
@@ -673,7 +673,9 @@  struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc *rproc,
 	rproc_add_subdev(rproc, &sysmon->subdev);
 
 	sysmon->nb.notifier_call = sysmon_notify;
-	blocking_notifier_chain_register(&sysmon_notifiers, &sysmon->nb);
+
+	if (blocking_notifier_chain_register(&sysmon_notifiers, &sysmon->nb))
+		pr_warn("sysmon notifier already registered\n");
 
 	mutex_lock(&sysmon_lock);
 	list_add(&sysmon->node, &sysmon_list);
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 502b6604b757..18d477e6141a 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -2790,7 +2790,9 @@  static int rproc_panic_handler(struct notifier_block *nb, unsigned long event,
 static void __init rproc_init_panic(void)
 {
 	rproc_panic_nb.notifier_call = rproc_panic_handler;
-	atomic_notifier_chain_register(&panic_notifier_list, &rproc_panic_nb);
+
+	if (atomic_notifier_chain_register(&panic_notifier_list, &rproc_panic_nb))
+		pr_warn("Remote Proc notifier already registered\n");
 }
 
 static void __exit rproc_exit_panic(void)