]> git.hungrycats.org Git - linux/commitdiff
net: ethernet: sun4i-emac: Fix IRQ error handling
authorbui duc phuc <phucduc.bui@gmail.com>
Mon, 24 Aug 2026 10:09:01 +0000 (17:09 +0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Sep 2026 11:36:14 +0000 (13:36 +0200)
[ Upstream commit 991c2be78257cba5bf53cf935fe70f8836964288 ]

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.

Fixes: 492205050d77 ("net: Add EMAC ethernet driver found on Allwinner A10 SoC's")
Signed-off-by: bui duc phuc <phucduc.bui@gmail.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Link: https://patch.msgid.link/20260824100901.31675-1-phucduc.bui@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/allwinner/sun4i-emac.c

index 2f516b950f4ea3284e06bc34c82b548279f63dcf..a573c3c61f7692fcd2c4c64fb1f65082566e6003 100644 (file)
@@ -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;
        }