[PATCH 3/8] irqchip/imx-intmux: Handle platform_irq_count() errors

Peng Fan peng.fan at linux.dev
Mon Nov 16 23:14:07 PST 2026


From: Peng Fan <peng.fan at nxp.com>

platform_irq_count() returns a negative errno on failure, but the driver
only special-cased -EPROBE_DEFER. For any other negative value probe
continued with a negative channel count and passed it to
devm_kzalloc_flex(), which is broken.

Propagate every negative return value and also reject a zero channel
count, which would otherwise register a controller without any channels.

Fixes: 2fbb13961e74 ("irqchip: Add NXP INTMUX interrupt multiplexer support")
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 drivers/irqchip/irq-imx-intmux.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/irqchip/irq-imx-intmux.c b/drivers/irqchip/irq-imx-intmux.c
index 644282228f1a..c7b6b475bfb9 100644
--- a/drivers/irqchip/irq-imx-intmux.c
+++ b/drivers/irqchip/irq-imx-intmux.c
@@ -207,11 +207,11 @@ static int imx_intmux_probe(struct platform_device *pdev)
 	int i, ret;
 
 	channum = platform_irq_count(pdev);
-	if (channum == -EPROBE_DEFER) {
-		return -EPROBE_DEFER;
-	} else if (channum > CHAN_MAX_NUM) {
-		dev_err(&pdev->dev, "supports up to %d multiplex channels\n",
-			CHAN_MAX_NUM);
+	if (channum < 0)
+		return channum;
+	if (!channum || channum > CHAN_MAX_NUM) {
+		dev_err(&pdev->dev, "invalid number of channels: %d\n",
+			channum);
 		return -EINVAL;
 	}
 

-- 
2.56.0




More information about the linux-arm-kernel mailing list