diff options
author | Andrew Donnellan <andrew.donnellan@au1.ibm.com> | 2016-04-26 10:55:04 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-04-27 02:23:41 +0300 |
commit | 4ad5e8831e1cb663f17112e44406b5ca9649ba1f (patch) | |
tree | 0d4d7abda81c52fb468ca552d8b8accec5685755 /arch/powerpc/sysdev | |
parent | 2d5217840ff1d0cf0f88201a922ab35bd083f7fb (diff) | |
download | linux-4ad5e8831e1cb663f17112e44406b5ca9649ba1f.tar.xz |
powerpc/mpic: handle subsys_system_register() failure
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>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r-- | arch/powerpc/sysdev/mpic.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index afe3c7cd395d..7de45b2df366 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c @@ -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; } |