Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 128d5874c082 ("net: ti: icssg-prueth: Add ICSSG ethernet driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: MD Danish Anwar <danishanwar@ti.com>
Link: https://lore.kernel.org/r/05282415-e7f4-42f3-99f8-32fde8f30936@moroto.mountain
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Dan Carpenter and committed by
Jakub Kicinski
4dcd0e83 46bf0c9a

+5 -3
+5 -3
drivers/net/ethernet/ti/icssg/icssg_prueth.c
··· 421 421 if (!i) 422 422 fdqring_id = k3_udma_glue_rx_flow_get_fdq_id(rx_chn->rx_chn, 423 423 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; 427 428 netdev_err(ndev, "Failed to get rx dma irq"); 428 429 goto fail; 429 430 } 431 + rx_chn->irq[i] = ret; 430 432 } 431 433 432 434 return 0;