powerpc: 8xx: fix a return value error in mpc8xx_pic_init
authorHangyu Hua <hbh25y@gmail.com>
Wed, 23 Feb 2022 07:02:23 +0000 (15:02 +0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 9 Mar 2022 10:46:55 +0000 (21:46 +1100)
mpc8xx_pic_init() should return -ENOMEM instead of 0 when
irq_domain_add_linear() return NULL. This cause mpc8xx_pics_init to continue
executing even if mpc8xx_pic_host is NULL.

Fixes: cc76404feaed ("powerpc/8xx: Fix possible device node reference leak")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220223070223.26845-1-hbh25y@gmail.com
arch/powerpc/platforms/8xx/pic.c

index f2ba837249d694ab47a843ecff366191b64ea4cb..04a6abf14c2958ca5f3f98a3bba203152be5104c 100644 (file)
@@ -153,6 +153,7 @@ int __init mpc8xx_pic_init(void)
        if (mpc8xx_pic_host == NULL) {
                printk(KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n");
                ret = -ENOMEM;
+               goto out;
        }
 
        ret = 0;