Skip to content

Commit a17259c

Browse files
Dan CarpenterSasha Levin
authored andcommitted
net: ti: icssg-prueth: Fix signedness bug in prueth_init_rx_chns()
[ Upstream commit 4dcd0e8 ] 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: 128d587 ("net: ti: icssg-prueth: Add ICSSG ethernet driver") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Roger Quadros <[email protected]> Reviewed-by: MD Danish Anwar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 33d41c8 commit a17259c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/net/ethernet/ti/icssg/icssg_prueth.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,14 @@ static int prueth_init_rx_chns(struct prueth_emac *emac,
421421
if (!i)
422422
fdqring_id = k3_udma_glue_rx_flow_get_fdq_id(rx_chn->rx_chn,
423423
i);
424-
rx_chn->irq[i] = k3_udma_glue_rx_get_irq(rx_chn->rx_chn, i);
425-
if (rx_chn->irq[i] <= 0) {
426-
ret = rx_chn->irq[i];
424+
ret = k3_udma_glue_rx_get_irq(rx_chn->rx_chn, i);
425+
if (ret <= 0) {
426+
if (!ret)
427+
ret = -ENXIO;
427428
netdev_err(ndev, "Failed to get rx dma irq");
428429
goto fail;
429430
}
431+
rx_chn->irq[i] = ret;
430432
}
431433

432434
return 0;

0 commit comments

Comments
 (0)