net: xilinx: axienet: Propagate errors from optional IRQ lookup
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
@@ -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
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
@@ -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
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
@@ -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
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,-ENXIOindicates 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.Signed-off-by bui duc phuc <[email protected]>
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@@ -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);
Re: [PATCH v3 2/3] net: xilinx: axienet: Handle optional IRQ return value correctly
In reply to [email protected]Quoted 10 lines · On 8/17/2026 4:22 PM, [email protected] wrote:
From: bui duc phuc <[email protected]>
lp->eth_irqis assigned fromplatform_get_irq_optional(), which returns a non-zero interrupt number on success or a negative error number on failure. Errors other than-ENXIOare handled before this check, so-ENXIOis the only error value that can reach this point.Check for a negative value instead of treating 0 as an undefined IRQ.
Signed-off-by bui duc phuc <[email protected]>
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@@ -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 */
Re: [PATCH v3 3/3] net: xilinx: axienet: Propagate errors from platform_get_irq()
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()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.Signed-off-by bui duc phuc <[email protected]>
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@@ -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;
Paolo Abeni
maintainerRe: [PATCH v3 2/3] net: xilinx: axienet: Handle optional IRQ return value correctly
In reply to Pandey, Radhey ShyamQuoted 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_irqis assigned fromplatform_get_irq_optional(), which returns a non-zero interrupt number on success or a negative error number on failure. Errors other than-ENXIOare handled before this check, so-ENXIOis 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.
Signed-off-by bui duc phuc <[email protected]>Reviewed-by Radhey Shyam Pandey <[email protected]>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
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.rstbefore submitting the next revision.
I’ll update the series accordingly in the
next revision.
Best regards,
Phuc