Skip to contentSkip to conversation

net: xilinx: axienet: Propagate errors from optional IRQ lookup

PATCH Superseded [email protected] 3 participants 8 messages Aug 17 – Aug 20

Subsystems (4)

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/3 net: xilinx: axienet: Propagate errors from optional IRQ lookup

From: bui duc phuc <[email protected]>

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.

---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +2 -0
index fcf517069d16..f92951422b2e 100644
@@ -2972,6 +2972,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);
Signature · 1 line
2.43.0
#1 lore raw

PATCH v3 2/3 net: xilinx: axienet: Handle optional IRQ return value correctly

From: bui duc phuc <[email protected]>

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.

---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1 -1
index f92951422b2e..50f88a38b6f6 100644
@@ -3049,7 +3049,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 */
Signature · 1 line
2.43.0
Reviewed-by Radhey Shyam Pandey on v3 2/3
#2 lore raw

Re: [PATCH v3 2/3] net: xilinx: axienet: Handle optional IRQ return value correctly

Quoted 10 lines · On 8/17/2026 4:22 PM, [email protected] wrote:

From: bui duc phuc <[email protected]>

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.

Thanks!

Quoted 17 lines
---
  drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1 -1
index f92951422b2e..50f88a38b6f6 100644
@@ -3049,7 +3049,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 */
maintainer
#3 lore raw

Re: [PATCH v3 2/3] net: xilinx: axienet: Handle optional IRQ return value correctly

Quoted 8 lines · Radhey Shyam
Quoted 7 lines · On 8/17/2026 4:22 PM, [email protected] wrote:

From: bui duc phuc <[email protected]>

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.

Quoted 6 lines
Quoted 3 lines

Check for a negative value instead of treating 0 as an undefined IRQ.

Thanks!

IMHO even this one is 'net' material deserving a fixes tag.

@bui: please re-submit the whole series targeting the proper tree and including the needed tags. Be sure to read and understand the relevant documentation including:

Documentation/process/maintainer-netdev.rst

before submitting the next revision.

/P

#4 lore raw

Re: [PATCH v3 2/3] net: xilinx: axienet: Handle optional IRQ return value correctly

Hi Paolo,

Thanks for the guidance.

Quoted 10 lines

IMHO even this one is 'net' material deserving a fixes tag.

@bui: please re-submit the whole series targeting the proper tree and including the needed tags. Be sure to read and understand the relevant documentation including:

Documentation/process/maintainer-netdev.rst

before submitting the next revision.

I’ll update the series accordingly in the
next revision.

Best regards,
Phuc

#5 lore raw

PATCH v3 3/3 net: xilinx: axienet: Propagate errors from platform_get_irq()

In reply to [email protected]

From: bui duc phuc <[email protected]>

platform_get_irq() returns a non-zero IRQ number on success and a negative error number on failure. Therefore, 0 should not be treated as an invalid IRQ number.

Propagate the original error code instead of overwriting it with -ENOMEM.

Remove the redundant error message since platform_get_irq() already reports errors when the IRQ lookup fails.

---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +4 -4
index 50f88a38b6f6..d982ab6f8a4a 100644
@@ -2968,10 +2968,10 @@ 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) {
-			dev_err(&pdev->dev, "could not determine irqs\n");
-			return -ENOMEM;
-		}
+		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;
 
Signature · 1 line
2.43.0
Reviewed-by Radhey Shyam Pandey on v3 3/3
#6 lore raw

Re: [PATCH v3 3/3] net: xilinx: axienet: Propagate errors from platform_get_irq()

Quoted 6 lines · On 8/17/2026 4:22 PM, [email protected] wrote:

From: bui duc phuc <[email protected]>

platform_get_irq() returns a non-zero IRQ number on success and a negative error number on failure. Therefore, 0 should not be treated as an invalid IRQ number.

Quoted 7 lines

Propagate the original error code instead of overwriting it with -ENOMEM.

Remove the redundant error message since platform_get_irq() already reports errors when the IRQ lookup fails.

This is a bug fix. So please add a fixes tag and same for 1/3 patch.

Thanks!

Quoted 23 lines
---
  drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +4 -4
index 50f88a38b6f6..d982ab6f8a4a 100644
@@ -2968,10 +2968,10 @@ 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) {
-			dev_err(&pdev->dev, "could not determine irqs\n");
-			return -ENOMEM;
-		}
+		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;
 
Reviewed-by Radhey Shyam Pandey on v3 1/3
#7 lore raw
In reply to [email protected]
Quoted 6 lines · On 8/17/2026 4:22 PM, [email protected] wrote:

From: bui duc phuc <[email protected]>

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.

Quoted 8 lines

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.

Thanks!

Quoted 17 lines
---
  drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +2 -0
index fcf517069d16..f92951422b2e 100644
@@ -2972,6 +2972,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);