[PATCH net-next v6 3/3] net: xilinx: axienet: Fix IRQ error handling

Gupta, Suraj suraj.gupta2 at amd.com
Wed Sep 9 09:14:59 PDT 2026



On 9/9/2026 10:24 AM, phucduc.bui at gmail.com wrote:
> From: bui duc phuc <phucduc.bui at gmail.com>
> 
> irq_of_parse_and_map() returns 0 when parsing or mapping an IRQ fails,
> while platform_get_irq() returns a negative error code on failure.
> 
> Handle both failure cases appropriately: return -EINVAL when
> irq_of_parse_and_map() fails, and propagate the original error code
> returned by platform_get_irq() instead of returning -ENOMEM.
> 
> Reviewed-by: Simon Horman <horms at kernel.org>
> Signed-off-by: bui duc phuc <phucduc.bui at gmail.com>
> ---

Reviewed-by: Suraj Gupta <suraj.gupta2 at amd.com>

Thanks!
Suraj

> 
> Changes in v4 :
>   - Add error handling for irq_of_parse_and_map()
> Changes in v5 :
>   - Change the error code returned when irq_of_parse_and_map() fails
>     from -ENOMEM to -EINVAL.
> Changes in v6 :
>   - Add Simon's Reviewed-by: tag.
>   - Drop the Fixes: tag as this patch is intended for net-next.
> 
>   drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index 3927ababf833..782f903d318f 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -2971,10 +2971,14 @@ 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) {
> +		if (!lp->rx_irq || !lp->tx_irq) {
>   			dev_err(&pdev->dev, "could not determine irqs\n");
> -			return -ENOMEM;
> +			return -EINVAL;
>   		}
> +		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;
>   




More information about the linux-arm-kernel mailing list