Skip to content

Commit f9a1d32

Browse files
Dan Carpenterdavem330
authored andcommitted
dmaengine: ti: k3-udma-glue: clean up k3_udma_glue_tx_get_irq() return
The k3_udma_glue_tx_get_irq() function currently returns negative error codes on error, zero on error and positive values for success. This complicates life for the callers who need to propagate the error code. Also GCC will not warn about unsigned comparisons when you check: if (unsigned_irq <= 0) All the callers have been fixed now but let's just make this easy going forward. Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: Roger Quadros <[email protected]> Acked-by: Vinod Koul <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a325f17 commit f9a1d32

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

drivers/dma/ti/k3-udma-glue.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,9 @@ int k3_udma_glue_tx_get_irq(struct k3_udma_glue_tx_channel *tx_chn)
558558
tx_chn->virq = k3_ringacc_get_ring_irq_num(tx_chn->ringtxcq);
559559
}
560560

561+
if (!tx_chn->virq)
562+
return -ENXIO;
563+
561564
return tx_chn->virq;
562565
}
563566
EXPORT_SYMBOL_GPL(k3_udma_glue_tx_get_irq);

drivers/net/ethernet/ti/am65-cpsw-nuss.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,10 +1747,10 @@ static int am65_cpsw_nuss_init_tx_chns(struct am65_cpsw_common *common)
17471747
}
17481748

17491749
tx_chn->irq = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
1750-
if (tx_chn->irq <= 0) {
1750+
if (tx_chn->irq < 0) {
17511751
dev_err(dev, "Failed to get tx dma irq %d\n",
17521752
tx_chn->irq);
1753-
ret = tx_chn->irq ?: -ENXIO;
1753+
ret = tx_chn->irq;
17541754
goto err;
17551755
}
17561756

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,7 @@ static int prueth_init_tx_chns(struct prueth_emac *emac)
317317
}
318318

319319
ret = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
320-
if (ret <= 0) {
321-
if (!ret)
322-
ret = -EINVAL;
320+
if (ret < 0) {
323321
netdev_err(ndev, "failed to get tx irq\n");
324322
goto fail;
325323
}

0 commit comments

Comments
 (0)