net: xilinx: axienet: Propagate errors from optional IRQ lookup
Subsystems (5)
PATCH 1/1 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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +5 -1
@@ -2957,12 +2957,16 @@ static int axienet_probe(struct platform_device *pdev) lp->tx_irq =irq_of_parse_and_map (np,0 );of_node_put (np); lp->eth_irq =platform_get_irq_optional (pdev,0 ); +if (lp->eth_irq <0 && lp->eth_irq != -ENXIO ) +return lp->eth_irq; }else {/* Check for these resources directly on the Ethernet node. */ lp->dma_regs =devm_platform_get_and_ioremap_resource (pdev,1 ,NULL ); lp->rx_irq =platform_get_irq (pdev,1 ); lp->tx_irq =platform_get_irq (pdev,0 ); lp->eth_irq =platform_get_irq_optional (pdev,2 ); +if (lp->eth_irq <0 && lp->eth_irq != -ENXIO ) +return lp->eth_irq; }if (IS_ERR (lp->dma_regs)) {dev_err (&pdev->dev,"could not map DMA regs\n" );
@@ -3047,7 +3051,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
Quoted 14 lines · On Tue, Aug 11, 2026 at 10:47:15AM +0700, [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.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 static int axienet_probe(struct platform_device *pdev) · line 3055
Quoted 6 lines
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1
-1@@ -3047,7 +3051,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" );
What has this change got to do with what is described in the commit message? If you think this is a needed change, please put it in a commit of its own, with a good commit message.
Andrew
Hi Andrew,
Thank you for your review.
Quoted 2 lines
Quoted 2 lines
platform_get_irq_optional()returns a positive IRQ number on success or a negative error code on failure.
........
Quoted 9 lines
drivers/net/ethernet/xilinx/xilinx_axienet_main.c static int axienet_probe(struct platform_device *pdev) · line 3055
Quoted 4 lines
/* Check for Ethernet core IRQ (optional) */drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1
-1-if (lp->eth_irq <=0 ) +if (lp->eth_irq <0 )dev_info (&pdev->dev,"Ethernet core IRQ not defined\n" );What has this change got to do with what is described in the commit message? If you think this is a needed change, please put it in a commit of its own, with a good commit message.
lp->eth_irq is assigned from platform_get_irq_optional(), which returns a positive IRQ number on success or a negative error code on failure. Therefore, a value of 0 is not possible here, so changing <= 0 to < 0 is directly related to the error handling described in the commit message.
Best regards,
Phuc
Quoted 17 lines · Bui Duc Phuc
Hi Andrew,
Thank you for your review.
Quoted 2 lines
Quoted 2 lines
platform_get_irq_optional()returns a positive IRQ number on success or a negative error code on failure.........
Quoted 9 lines
drivers/net/ethernet/xilinx/xilinx_axienet_main.c static int axienet_probe(struct platform_device *pdev) · line 3055
Quoted 4 lines
/* Check for Ethernet core IRQ (optional) */drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1
-1-if (lp->eth_irq <=0 ) +if (lp->eth_irq <0 )dev_info (&pdev->dev,"Ethernet core IRQ not defined\n" );What has this change got to do with what is described in the commit message? If you think this is a needed change, please put it in a commit of its own, with a good commit message.
Quoted 4 lines
lp->eth_irqis assigned fromplatform_get_irq_optional(), which returns a positive IRQ number on success or a negative error code on failure. Therefore, a value of 0 is not possible here, so changing <= 0 to < 0 is directly related to the error handling described in the commit message.
I think this is a separate change. You can then reference the documentation, and its example:
https://elixir.bootlin.com/linux/v7.1.8/source/drivers/base/platform.c#L270
Andrew
Hi Andrew,
Thanks for the feedback.
Quoted 10 lines
Quoted 4 lines
lp->eth_irqis assigned fromplatform_get_irq_optional(), which returns a positive IRQ number on success or a negative error code on failure. Therefore, a value of 0 is not possible here, so changing <= 0 to < 0 is directly related to the error handling described in the commit message.I think this is a separate change. You can then reference the documentation, and its example:
https://elixir.bootlin.com/linux/v7.1.8/source/drivers/base/platform.c#L270
I’ll split this change into a separate commit.
Best regards,
Phuc