Commit 4dcd0e83 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jakub Kicinski

net: ti: icssg-prueth: Fix signedness bug in prueth_init_rx_chns()

The rx_chn->irq[] array is unsigned int but it should be signed for the
error handling to work.  Also if k3_udma_glue_rx_get_irq() returns zero
then we should return -ENXIO instead of success.

Fixes: 128d5874 ("net: ti: icssg-prueth: Add ICSSG ethernet driver")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: default avatarRoger Quadros <rogerq@kernel.org>
Reviewed-by: default avatarMD Danish Anwar <danishanwar@ti.com>
Link: https://lore.kernel.org/r/05282415-e7f4-42f3-99f8-32fde8f30936@moroto.mountainSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 46bf0c9a
...@@ -421,12 +421,14 @@ static int prueth_init_rx_chns(struct prueth_emac *emac, ...@@ -421,12 +421,14 @@ static int prueth_init_rx_chns(struct prueth_emac *emac,
if (!i) if (!i)
fdqring_id = k3_udma_glue_rx_flow_get_fdq_id(rx_chn->rx_chn, fdqring_id = k3_udma_glue_rx_flow_get_fdq_id(rx_chn->rx_chn,
i); i);
rx_chn->irq[i] = k3_udma_glue_rx_get_irq(rx_chn->rx_chn, i); ret = k3_udma_glue_rx_get_irq(rx_chn->rx_chn, i);
if (rx_chn->irq[i] <= 0) { if (ret <= 0) {
ret = rx_chn->irq[i]; if (!ret)
ret = -ENXIO;
netdev_err(ndev, "Failed to get rx dma irq"); netdev_err(ndev, "Failed to get rx dma irq");
goto fail; goto fail;
} }
rx_chn->irq[i] = ret;
} }
return 0; return 0;
......
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