irqchip/loongson-liointc: Fix improper error handling in liointc_init()
authorLiu Peibao <liupeibao@loongson.cn>
Fri, 4 Nov 2022 11:07:12 +0000 (19:07 +0800)
committerMarc Zyngier <maz@kernel.org>
Sat, 26 Nov 2022 13:29:57 +0000 (13:29 +0000)
For cores less than 4, eg, loongson2k1000 with 2 cores, the
of_property_match_string() may return with an error value,
which causes that liointc could not work. At least isr0 is
what should be checked like previous commit b2c4c3969fd7
("irqchip/loongson-liointc: irqchip add 2.0 version") did.

Fixes: 0858ed035a85 ("irqchip/loongson-liointc: Add ACPI init support")
Signed-off-by: Liu Peibao <liupeibao@loongson.cn>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20221104110712.23300-1-liupeibao@loongson.cn
drivers/irqchip/irq-loongson-liointc.c

index 0da8716..c4584e2 100644 (file)
@@ -207,10 +207,13 @@ static int liointc_init(phys_addr_t addr, unsigned long size, int revision,
                                        "reg-names", core_reg_names[i]);
 
                        if (index < 0)
-                               goto out_iounmap;
+                               continue;
 
                        priv->core_isr[i] = of_iomap(node, index);
                }
+
+               if (!priv->core_isr[0])
+                       goto out_iounmap;
        }
 
        /* Setup IRQ domain */