Re: [PATCH net] net: ethernet: sun4i-emac: Fix IRQ error handling
Andre Przywara <[email protected]>
| Newsgroups | org.infradead.lists.linux-arm-kernel,dev.linux.lists.linux-sunxi,org.kernel.vger.linux-kernel,org.kernel.vger.netdev |
|---|---|
| Message-ID | <[email protected]> |
Hi, On 8/24/26 12:09, [email protected] wrote: > From: bui duc phuc <[email protected]> > > irq_of_parse_and_map() returns 0 when parsing or mapping an IRQ fails. > The current code checks for -ENXIO and therefore does not detect the > failure. > > Check for a zero return value and convert it to -ENXIO. Yes, the return value is the IRQ number, or 0 in case of a missing IRQ. > Fixes: 492205050d77 ("net: Add EMAC ethernet driver found on Allwinner A10 SoC's") > Signed-off-by: bui duc phuc <[email protected]> Reviewed-by: Andre Przywara <[email protected]> Thanks, Andre > --- > drivers/net/ethernet/allwinner/sun4i-emac.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c > index 42174249ef61..942454e29488 100644 > --- a/drivers/net/ethernet/allwinner/sun4i-emac.c > +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c > @@ -996,9 +996,9 @@ static int emac_probe(struct platform_device *pdev) > /* fill in parameters for net-dev structure */ > ndev->base_addr = (unsigned long)db->membase; > ndev->irq = irq_of_parse_and_map(np, 0); > - if (ndev->irq == -ENXIO) { > + if (!ndev->irq) { > netdev_err(ndev, "No irq resource\n"); > - ret = ndev->irq; > + ret = -ENXIO; > goto out_iounmap; > } >