Subject: [PATCH v1 02/12] powerpc/pseries: CMM: Report errors when registering notifiers fails

From: David Hildenbrand <[email-masked]>
Date: Thu, 31 Oct 2019 15:29:23 +0100

If we don't set the rc, we will return "0", making it look like we
succeeded.

Cc: Benjamin Herrenschmidt <[email-masked]>
Cc: Paul Mackerras <[email-masked]>
Cc: Michael Ellerman <[email-masked]>
Cc: Andrew Morton <[email-masked]>
Cc: Pavel Tatashin <[email-masked]>
Cc: Richard Fontana <[email-masked]>
Cc: Allison Randal <[email-masked]>
Cc: Thomas Gleixner <[email-masked]>
Cc: Arun KS <[email-masked]>
Signed-off-by: David Hildenbrand <[email-masked]>
---
 arch/powerpc/platforms/pseries/cmm.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 572651a5c87b..fab049d3ea1e 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -683,8 +683,12 @@ static int cmm_init(void)
 	if ((rc = cmm_sysfs_register(&cmm_dev)))
 		goto out_reboot_notifier;
 
-	if (register_memory_notifier(&cmm_mem_nb) ||
-	    register_memory_isolate_notifier(&cmm_mem_isolate_nb))
+	rc = register_memory_notifier(&cmm_mem_nb);
+	if (rc)
+		goto out_unregister_notifier;
+
+	rc = register_memory_isolate_notifier(&cmm_mem_isolate_nb);
+	if (rc)
 		goto out_unregister_notifier;
 
 	if (cmm_disabled)
-- 
2.21.0