Commit ef45e840 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jakub Kicinski

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: 8425c41d ("net: ll_temac: Extend support to non-device-tree platforms")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Acked-by: default avatarEsben Haabendal <esben@geanix.com>
Reviewed-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Reviewed-by: default avatarHarini Katakam <harini.katakam@amd.com>
Link: https://lore.kernel.org/r/3d0aef75-06e0-45a5-a2a6-2cc4738d4143@moroto.mountainSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 13d2618b
......@@ -1567,12 +1567,16 @@ static int temac_probe(struct platform_device *pdev)
}
/* Error handle returned DMA RX and TX interrupts */
if (lp->rx_irq < 0)
return dev_err_probe(&pdev->dev, lp->rx_irq,
if (lp->rx_irq <= 0) {
rc = lp->rx_irq ?: -EINVAL;
return dev_err_probe(&pdev->dev, rc,
"could not get DMA RX irq\n");
if (lp->tx_irq < 0)
return dev_err_probe(&pdev->dev, lp->tx_irq,
}
if (lp->tx_irq <= 0) {
rc = lp->tx_irq ?: -EINVAL;
return dev_err_probe(&pdev->dev, rc,
"could not get DMA TX irq\n");
}
if (temac_np) {
/* Retrieve the MAC address */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment