Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andrew Donnellan and committed by
Michael Ellerman
4ad5e883 2d521784

+8 -1
+8 -1
arch/powerpc/sysdev/mpic.c
··· 2004 2004 2005 2005 static int mpic_init_sys(void) 2006 2006 { 2007 + int rc; 2008 + 2007 2009 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 + } 2009 2016 2010 2017 return 0; 2011 2018 }