]> git.karo-electronics.de Git - linux-beck.git/commitdiff
powerpc/mpic: handle subsys_system_register() failure
authorAndrew Donnellan <andrew.donnellan@au1.ibm.com>
Tue, 26 Apr 2016 07:55:04 +0000 (17:55 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 26 Apr 2016 23:23:41 +0000 (09:23 +1000)
mpic_init_sys() currently doesn't check whether
subsys_system_register() succeeded or not. Check the return code of
subsys_system_register() and clean up if there's an error.

Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/sysdev/mpic.c

index afe3c7cd395d3ddce0077d79044f71f3030fd164..7de45b2df36699abf7cb4ce98e710aba0bce2ab3 100644 (file)
@@ -2004,8 +2004,15 @@ static struct syscore_ops mpic_syscore_ops = {
 
 static int mpic_init_sys(void)
 {
+       int rc;
+
        register_syscore_ops(&mpic_syscore_ops);
-       subsys_system_register(&mpic_subsys, NULL);
+       rc = subsys_system_register(&mpic_subsys, NULL);
+       if (rc) {
+               unregister_syscore_ops(&mpic_syscore_ops);
+               pr_err("mpic: Failed to register subsystem!\n");
+               return rc;
+       }
 
        return 0;
 }