Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] net: xilinx: axienet: Propagate errors from optional IRQ lookup
@ 2026-08-17 10:52 phucduc.bui
  2026-08-17 10:52 ` [PATCH v3 2/3] net: xilinx: axienet: Handle optional IRQ return value correctly phucduc.bui
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: phucduc.bui @ 2026-08-17 10:52 UTC (permalink / raw)
  To: Radhey Shyam Pandey, Andrew Lunn, davem, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Michal Simek, Simon Horman
  Cc: 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 | 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 fcf517069d16..f92951422b2e 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -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);
-- 
2.43.0



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

* [PATCH v3 2/3] net: xilinx: axienet: Handle optional IRQ return value correctly
  2026-08-17 10:52 [PATCH v3 1/3] net: xilinx: axienet: Propagate errors from optional IRQ lookup phucduc.bui
@ 2026-08-17 10:52 ` phucduc.bui
  2026-08-17 10:52 ` [PATCH v3 3/3] net: xilinx: axienet: Propagate errors from platform_get_irq() phucduc.bui
  2026-08-17 13:58 ` [PATCH v3 1/3] net: xilinx: axienet: Propagate errors from optional IRQ lookup Pandey, Radhey Shyam
  2 siblings, 0 replies; 4+ messages in thread
From: phucduc.bui @ 2026-08-17 10:52 UTC (permalink / raw)
  To: Radhey Shyam Pandey, Andrew Lunn, davem, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Michal Simek, Simon Horman
  Cc: netdev, linux-arm-kernel, linux-kernel, bui duc phuc

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

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.

Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
---
 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 f92951422b2e..50f88a38b6f6 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -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 */
-- 
2.43.0



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

* [PATCH v3 3/3] net: xilinx: axienet: Propagate errors from platform_get_irq()
  2026-08-17 10:52 [PATCH v3 1/3] net: xilinx: axienet: Propagate errors from optional IRQ lookup phucduc.bui
  2026-08-17 10:52 ` [PATCH v3 2/3] net: xilinx: axienet: Handle optional IRQ return value correctly phucduc.bui
@ 2026-08-17 10:52 ` phucduc.bui
  2026-08-17 13:58 ` [PATCH v3 1/3] net: xilinx: axienet: Propagate errors from optional IRQ lookup Pandey, Radhey Shyam
  2 siblings, 0 replies; 4+ messages in thread
From: phucduc.bui @ 2026-08-17 10:52 UTC (permalink / raw)
  To: Radhey Shyam Pandey, Andrew Lunn, davem, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Michal Simek, Simon Horman
  Cc: netdev, linux-arm-kernel, linux-kernel, bui duc phuc

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

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.

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

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 50f88a38b6f6..d982ab6f8a4a 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -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;
 
-- 
2.43.0



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

* Re: [PATCH v3 1/3] net: xilinx: axienet: Propagate errors from optional IRQ lookup
  2026-08-17 10:52 [PATCH v3 1/3] net: xilinx: axienet: Propagate errors from optional IRQ lookup phucduc.bui
  2026-08-17 10:52 ` [PATCH v3 2/3] net: xilinx: axienet: Handle optional IRQ return value correctly phucduc.bui
  2026-08-17 10:52 ` [PATCH v3 3/3] net: xilinx: axienet: Propagate errors from platform_get_irq() phucduc.bui
@ 2026-08-17 13:58 ` Pandey, Radhey Shyam
  2 siblings, 0 replies; 4+ messages in thread
From: Pandey, Radhey Shyam @ 2026-08-17 13:58 UTC (permalink / raw)
  To: phucduc.bui, Radhey Shyam Pandey, Andrew Lunn, davem,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Michal Simek,
	Simon Horman
  Cc: netdev, linux-arm-kernel, linux-kernel

On 8/17/2026 4:22 PM, 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.
> 
> Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>

Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Thanks!

> ---
>   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 fcf517069d16..f92951422b2e 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -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);



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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17 10:52 [PATCH v3 1/3] net: xilinx: axienet: Propagate errors from optional IRQ lookup phucduc.bui
2026-08-17 10:52 ` [PATCH v3 2/3] net: xilinx: axienet: Handle optional IRQ return value correctly phucduc.bui
2026-08-17 10:52 ` [PATCH v3 3/3] net: xilinx: axienet: Propagate errors from platform_get_irq() phucduc.bui
2026-08-17 13:58 ` [PATCH v3 1/3] net: xilinx: axienet: Propagate errors from optional IRQ lookup Pandey, Radhey Shyam

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