Skip to content

Commit 4ad5e88

Browse files
ajdlinuxmpe
authored andcommitted
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>
1 parent 2d52178 commit 4ad5e88

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎arch/powerpc/sysdev/mpic.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2004,8 +2004,15 @@ static struct syscore_ops mpic_syscore_ops = {
20042004

20052005
static int mpic_init_sys(void)
20062006
{
2007+
int rc;
2008+
20072009
register_syscore_ops(&mpic_syscore_ops);
2008-
subsys_system_register(&mpic_subsys, NULL);
2010+
rc = subsys_system_register(&mpic_subsys, NULL);
2011+
if (rc) {
2012+
unregister_syscore_ops(&mpic_syscore_ops);
2013+
pr_err("mpic: Failed to register subsystem!\n");
2014+
return rc;
2015+
}
20092016

20102017
return 0;
20112018
}

0 commit comments

Comments
 (0)