Skip to content

Commit ef45e84

Browse files
Dan Carpenterkuba-moo
authored andcommitted
net: ll_temac: fix error checking of irq_of_parse_and_map()
Most kernel functions return negative error codes but some irq functions return zero on error. In this code irq_of_parse_and_map(), returns zero and platform_get_irq() returns negative error codes. We need to handle both cases appropriately. Fixes: 8425c41 ("net: ll_temac: Extend support to non-device-tree platforms") Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Esben Haabendal <[email protected]> Reviewed-by: Yang Yingliang <[email protected]> Reviewed-by: Harini Katakam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 13d2618 commit ef45e84

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/net/ethernet/xilinx/ll_temac_main.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,12 +1567,16 @@ static int temac_probe(struct platform_device *pdev)
15671567
}
15681568

15691569
/* Error handle returned DMA RX and TX interrupts */
1570-
if (lp->rx_irq < 0)
1571-
return dev_err_probe(&pdev->dev, lp->rx_irq,
1570+
if (lp->rx_irq <= 0) {
1571+
rc = lp->rx_irq ?: -EINVAL;
1572+
return dev_err_probe(&pdev->dev, rc,
15721573
"could not get DMA RX irq\n");
1573-
if (lp->tx_irq < 0)
1574-
return dev_err_probe(&pdev->dev, lp->tx_irq,
1574+
}
1575+
if (lp->tx_irq <= 0) {
1576+
rc = lp->tx_irq ?: -EINVAL;
1577+
return dev_err_probe(&pdev->dev, rc,
15751578
"could not get DMA TX irq\n");
1579+
}
15761580

15771581
if (temac_np) {
15781582
/* Retrieve the MAC address */

0 commit comments

Comments
 (0)