mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: xilinx: axienet: Propagate errors from optional IRQ lookup
@ 2026-08-11  3:47 phucduc.bui
  2026-08-11 17:00 ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: phucduc.bui @ 2026-08-11  3:47 UTC (permalink / raw)
  To: Radhey Shyam Pandey, Andrew Lunn, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Michal Simek
  Cc: linux-arm-msm, netdev, linux-arm-kernel, linux-kernel, bui duc phuc

From: bui duc phuc <phucduc.bui@gmail.com>

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index fcf517069d16..7ef099db1bcf 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -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 */
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: xilinx: axienet: Propagate errors from optional IRQ lookup
  2026-08-11  3:47 [PATCH] net: xilinx: axienet: Propagate errors from optional IRQ lookup phucduc.bui
@ 2026-08-11 17:00 ` Andrew Lunn
  2026-08-12  6:14   ` Bui Duc Phuc
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2026-08-11 17:00 UTC (permalink / raw)
  To: phucduc.bui
  Cc: Radhey Shyam Pandey, Andrew Lunn, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Michal Simek, linux-arm-msm, netdev,
	linux-arm-kernel, linux-kernel

On Tue, Aug 11, 2026 at 10:47:15AM +0700, phucduc.bui@gmail.com wrote:
> From: bui duc phuc <phucduc.bui@gmail.com>
> 
> 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.

> @@ -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: xilinx: axienet: Propagate errors from optional IRQ lookup
  2026-08-11 17:00 ` Andrew Lunn
@ 2026-08-12  6:14   ` Bui Duc Phuc
  2026-08-12 19:44     ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Bui Duc Phuc @ 2026-08-12  6:14 UTC (permalink / raw)
  To: andrew
  Cc: Radhey Shyam Pandey, Andrew Lunn, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Michal Simek, linux-arm-msm, netdev,
	linux-arm-kernel, linux-kernel

Hi Andrew,

Thank you for your review.

> > platform_get_irq_optional() returns a positive IRQ number on success or
> > a negative error code on failure.
........
> >       /* 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.
>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: xilinx: axienet: Propagate errors from optional IRQ lookup
  2026-08-12  6:14   ` Bui Duc Phuc
@ 2026-08-12 19:44     ` Andrew Lunn
  2026-08-13  2:01       ` Bui Duc Phuc
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2026-08-12 19:44 UTC (permalink / raw)
  To: Bui Duc Phuc
  Cc: Radhey Shyam Pandey, Andrew Lunn, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Michal Simek, linux-arm-msm, netdev,
	linux-arm-kernel, linux-kernel

On Wed, Aug 12, 2026 at 01:14:38PM +0700, Bui Duc Phuc wrote:
> Hi Andrew,
> 
> Thank you for your review.
> 
> > > platform_get_irq_optional() returns a positive IRQ number on success or
> > > a negative error code on failure.
> ........
> > >       /* 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.
> >
> 
> 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.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] net: xilinx: axienet: Propagate errors from optional IRQ lookup
  2026-08-12 19:44     ` Andrew Lunn
@ 2026-08-13  2:01       ` Bui Duc Phuc
  0 siblings, 0 replies; 5+ messages in thread
From: Bui Duc Phuc @ 2026-08-13  2:01 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Radhey Shyam Pandey, Andrew Lunn, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Michal Simek, linux-arm-msm, netdev,
	linux-arm-kernel, linux-kernel

Hi Andrew,

Thanks for the feedback.

> > 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.
>
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-08-13  2:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-11  3:47 [PATCH] net: xilinx: axienet: Propagate errors from optional IRQ lookup phucduc.bui
2026-08-11 17:00 ` Andrew Lunn
2026-08-12  6:14   ` Bui Duc Phuc
2026-08-12 19:44     ` Andrew Lunn
2026-08-13  2:01       ` Bui Duc Phuc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®