[PATCH net v5 2/2] net: fec: Handle optional IRQ lookup errors correctly
From: phucduc . bui
Date: Wed Sep 09 2026 - 03:06:00 EST
From: bui duc phuc <phucduc.bui@xxxxxxxxx>
Handle errors from platform_get_irq_byname_optional() explicitly while
preserving the existing fallback to platform_get_irq() when the named IRQ
is not available.
Propagate errors other than -ENXIO from the optional IRQ lookup instead
of silently falling back to the indexed IRQ lookup.
In particular, silently ignoring -EPROBE_DEFER can cause the driver to
continue probing instead of deferring as required.
Fixes: 3b56be218f65 ("net: fec_main: Use platform_get_irq_byname_optional() to avoid error message")
Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
drivers/net/ethernet/freescale/fec_main.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index c6e29b5c2abb..f7636f23d1eb 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -5397,12 +5397,17 @@ fec_probe(struct platform_device *pdev)
for (i = 0; i < irq_cnt; i++) {
snprintf(irq_name, sizeof(irq_name), "int%d", i);
irq = platform_get_irq_byname_optional(pdev, irq_name);
- if (irq < 0)
- irq = platform_get_irq(pdev, i);
- if (irq < 0) {
+ if (irq < 0 && irq != -ENXIO) {
ret = irq;
goto failed_irq;
}
+ if (irq == -ENXIO) {
+ irq = platform_get_irq(pdev, i);
+ if (irq < 0) {
+ ret = irq;
+ goto failed_irq;
+ }
+ }
ret = devm_request_irq(&pdev->dev, irq, fec_enet_interrupt,
0, pdev->name, ndev);
if (ret)
--
2.43.0