]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
dmaengine: ti: k3-udma-glue: clean up k3_udma_glue_tx_get_irq() return
authorDan Carpenter <dan.carpenter@linaro.org>
Tue, 26 Sep 2023 14:06:58 +0000 (17:06 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 4 Oct 2023 09:29:55 +0000 (10:29 +0100)
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 <dan.carpenter@linaro.org>
Reviewed-by: Roger Quadros <rogerq@kernel.org>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/dma/ti/k3-udma-glue.c
drivers/net/ethernet/ti/am65-cpsw-nuss.c
drivers/net/ethernet/ti/icssg/icssg_prueth.c

index 789193ed038650b5d73f64fd8db8cab84c031936..c278d5facf7d8bc6696e32d7f7ebc38c58b67afc 100644 (file)
@@ -558,6 +558,9 @@ int k3_udma_glue_tx_get_irq(struct k3_udma_glue_tx_channel *tx_chn)
                tx_chn->virq = k3_ringacc_get_ring_irq_num(tx_chn->ringtxcq);
        }
 
+       if (!tx_chn->virq)
+               return -ENXIO;
+
        return tx_chn->virq;
 }
 EXPORT_SYMBOL_GPL(k3_udma_glue_tx_get_irq);
index 31e84c503e2229ba3a052a28fc21e0b19b83d527..24120605502f9e8b7d3161d066902e2b8edc8a3f 100644 (file)
@@ -1747,10 +1747,10 @@ static int am65_cpsw_nuss_init_tx_chns(struct am65_cpsw_common *common)
                }
 
                tx_chn->irq = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
-               if (tx_chn->irq <= 0) {
+               if (tx_chn->irq < 0) {
                        dev_err(dev, "Failed to get tx dma irq %d\n",
                                tx_chn->irq);
-                       ret = tx_chn->irq ?: -ENXIO;
+                       ret = tx_chn->irq;
                        goto err;
                }
 
index e3dcb0845fb6daa394a60c580ff704fe81682de9..4914d0ef58e9b969dc82401be4922a0d13b4e9ad 100644 (file)
@@ -317,9 +317,7 @@ static int prueth_init_tx_chns(struct prueth_emac *emac)
                }
 
                ret = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
-               if (ret <= 0) {
-                       if (!ret)
-                               ret = -EINVAL;
+               if (ret < 0) {
                        netdev_err(ndev, "failed to get tx irq\n");
                        goto fail;
                }