[PATCH 16/16] irqchip/bcm7120-l2: fix parent IRQ count error handling

From: Haofeng Li

Date: Tue Jul 14 2026 - 09:34:34 EST


From: Haofeng Li <lihaofeng@xxxxxxxxxx>

When platform_irq_count() fails or returns zero, probe reported -ENOMEM
even though no memory allocation failed. Negative values such as
-EPROBE_DEFER were also discarded, which breaks deferred probe.

Propagate negative errno from platform_irq_count(), and return -EINVAL
only for a zero parent interrupt count.

Fixes: 3ac268d5ed22 ("irqchip/irq-bcm7120-l2: Switch to IRQCHIP_PLATFORM_DRIVER")
Signed-off-by: Haofeng Li <lihaofeng@xxxxxxxxxx>
---
drivers/irqchip/irq-bcm7120-l2.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
index a98f0ee46b6c..9f412c0be6d7 100644
--- a/drivers/irqchip/irq-bcm7120-l2.c
+++ b/drivers/irqchip/irq-bcm7120-l2.c
@@ -225,9 +225,13 @@ static int bcm7120_l2_intc_probe(struct platform_device *pdev, struct device_nod
return -ENOMEM;

data->num_parent_irqs = platform_irq_count(pdev);
- if (data->num_parent_irqs <= 0) {
+ if (data->num_parent_irqs < 0) {
+ ret = data->num_parent_irqs;
+ goto out_unmap;
+ }
+ if (!data->num_parent_irqs) {
pr_err("invalid number of parent interrupts\n");
- ret = -ENOMEM;
+ ret = -EINVAL;
goto out_unmap;
}

--
2.25.1