From 90ab44517ee1f9e5018b6c274b95219cf229e617 Mon Sep 17 00:00:00 2001 From: bui duc phuc Date: Wed, 9 Sep 2026 11:54:48 +0700 Subject: [PATCH 1/3] net: xilinx: axienet: Propagate errors from optional IRQ lookup platform_get_irq_optional() returns a positive IRQ number on success or a negative error code on failure. For an optional IRQ, -ENXIO indicates that no optional IRQ is available, while other errors should be propagated. Propagate all error codes returned by platform_get_irq_optional() other than -ENXIO. Another call to platform_get_irq_optional() in the same function already handles the return value this way. Apply the same error handling to this call site for consistency. Reviewed-by: Simon Horman Reviewed-by: Radhey Shyam Pandey Signed-off-by: bui duc phuc Link: https://patch.msgid.link/20260909045450.16176-2-phucduc.bui@gmail.com Signed-off-by: Jakub Kicinski --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 1722b7038f34..207aecb5f8b9 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2975,6 +2975,8 @@ static int axienet_probe(struct platform_device *pdev) dev_err(&pdev->dev, "could not determine irqs\n"); return -ENOMEM; } + if (lp->eth_irq < 0 && lp->eth_irq != -ENXIO) + return lp->eth_irq; /* Reset core now that clocks are enabled, prior to accessing MDIO */ ret = __axienet_device_reset(lp); From 2d2f18d49221846a5a3271ce93e08e4f9f784991 Mon Sep 17 00:00:00 2001 From: bui duc phuc Date: Wed, 9 Sep 2026 11:54:49 +0700 Subject: [PATCH 2/3] net: xilinx: axienet: Handle optional IRQ return value correctly lp->eth_irq is assigned from platform_get_irq_optional(), which returns a non-zero interrupt number on success or a negative error number on failure. Errors other than -ENXIO are handled before this check, so -ENXIO is the only error value that can reach this point. Check for a negative value instead of treating 0 as an undefined IRQ. Reviewed-by: Simon Horman Reviewed-by: Radhey Shyam Pandey Signed-off-by: bui duc phuc Link: https://patch.msgid.link/20260909045450.16176-3-phucduc.bui@gmail.com Signed-off-by: Jakub Kicinski --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 207aecb5f8b9..3927ababf833 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -3052,7 +3052,7 @@ static int axienet_probe(struct platform_device *pdev) ndev->ethtool_ops = &axienet_ethtool_ops; } /* Check for Ethernet core IRQ (optional) */ - if (lp->eth_irq <= 0) + if (lp->eth_irq < 0) dev_info(&pdev->dev, "Ethernet core IRQ not defined\n"); /* Retrieve the MAC address */ From bb2b71024976a39ed57d66bad8f9ca7e93bc3f33 Mon Sep 17 00:00:00 2001 From: bui duc phuc Date: Wed, 9 Sep 2026 11:54:50 +0700 Subject: [PATCH 3/3] net: xilinx: axienet: Fix IRQ error handling irq_of_parse_and_map() returns 0 when parsing or mapping an IRQ fails, while platform_get_irq() returns a negative error code on failure. Handle both failure cases appropriately: return -EINVAL when irq_of_parse_and_map() fails, and propagate the original error code returned by platform_get_irq() instead of returning -ENOMEM. Reviewed-by: Simon Horman Signed-off-by: bui duc phuc Reviewed-by: Suraj Gupta Link: https://patch.msgid.link/20260909045450.16176-4-phucduc.bui@gmail.com Signed-off-by: Jakub Kicinski --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 3927ababf833..782f903d318f 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -2971,10 +2971,14 @@ static int axienet_probe(struct platform_device *pdev) dev_err(&pdev->dev, "could not map DMA regs\n"); return PTR_ERR(lp->dma_regs); } - if (lp->rx_irq <= 0 || lp->tx_irq <= 0) { + if (!lp->rx_irq || !lp->tx_irq) { dev_err(&pdev->dev, "could not determine irqs\n"); - return -ENOMEM; + return -EINVAL; } + if (lp->rx_irq < 0) + return lp->rx_irq; + if (lp->tx_irq < 0) + return lp->tx_irq; if (lp->eth_irq < 0 && lp->eth_irq != -ENXIO) return lp->eth_irq;