Skip to content

Commit

Permalink
dmaengine: ti: k3-udma-glue: clean up return in k3_udma_glue_rx_get_i…
Browse files Browse the repository at this point in the history
…rq()

Currently the k3_udma_glue_rx_get_irq() function returns either negative
error codes or zero on error.  Generally, in the kernel, zero means
success so this be confusing and has caused bugs in the past.  Also the
"tx" version of this function only returns negative error codes.  Let's
clean this "rx" function so both functions match.

This patch has no effect on runtime.

Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Peter Ujfalusi <[email protected]>
Acked-by: Vinod Koul <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Dan Carpenter authored and davem330 committed Jun 9, 2024
1 parent 924ee53 commit 28f961f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 3 additions & 0 deletions drivers/dma/ti/k3-udma-glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1531,6 +1531,9 @@ int k3_udma_glue_rx_get_irq(struct k3_udma_glue_rx_channel *rx_chn,
flow->virq = k3_ringacc_get_ring_irq_num(flow->ringrx);
}

if (!flow->virq)
return -ENXIO;

return flow->virq;
}
EXPORT_SYMBOL_GPL(k3_udma_glue_rx_get_irq);
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/ethernet/ti/am65-cpsw-nuss.c
Original file line number Diff line number Diff line change
Expand Up @@ -2424,10 +2424,10 @@ static int am65_cpsw_nuss_init_rx_chns(struct am65_cpsw_common *common)

rx_chn->irq = k3_udma_glue_rx_get_irq(rx_chn->rx_chn, i);

if (rx_chn->irq <= 0) {
if (rx_chn->irq < 0) {
dev_err(dev, "Failed to get rx dma irq %d\n",
rx_chn->irq);
ret = -ENXIO;
ret = rx_chn->irq;
goto err;
}
}
Expand Down
4 changes: 1 addition & 3 deletions drivers/net/ethernet/ti/icssg/icssg_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,9 +440,7 @@ int prueth_init_rx_chns(struct prueth_emac *emac,
fdqring_id = k3_udma_glue_rx_flow_get_fdq_id(rx_chn->rx_chn,
i);
ret = k3_udma_glue_rx_get_irq(rx_chn->rx_chn, i);
if (ret <= 0) {
if (!ret)
ret = -ENXIO;
if (ret < 0) {
netdev_err(ndev, "Failed to get rx dma irq");
goto fail;
}
Expand Down

0 comments on commit 28f961f

Please sign in to comment.