* [PATCH 3/3 net] dmaengine: ti: k3-udma-glue: clean up k3_udma_glue_tx_get_irq() return
[not found] <4c2073cc-e7ef-4f16-9655-1a46cfed9fe9@moroto.mountain>
@ 2023-09-26 14:06 ` Dan Carpenter
2023-09-26 18:46 ` Roger Quadros
2023-09-28 7:50 ` Vinod Koul
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2023-09-26 14:06 UTC (permalink / raw)
To: Peter Ujfalusi
Cc: Vinod Koul, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Siddharth Vadapalli, Roger Quadros,
Grygorii Strashko, MD Danish Anwar, Andrew Lunn,
Vignesh Raghavendra, dmaengine, linux-kernel, netdev,
kernel-janitors
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>
---
drivers/dma/ti/k3-udma-glue.c | 3 +++
drivers/net/ethernet/ti/am65-cpsw-nuss.c | 4 ++--
drivers/net/ethernet/ti/icssg/icssg_prueth.c | 4 +---
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/dma/ti/k3-udma-glue.c b/drivers/dma/ti/k3-udma-glue.c
index 789193ed0386..c278d5facf7d 100644
--- a/drivers/dma/ti/k3-udma-glue.c
+++ b/drivers/dma/ti/k3-udma-glue.c
@@ -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);
diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index 31e84c503e22..24120605502f 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -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;
}
diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
index 89c0c3449d98..3c611b9aaecf 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
@@ -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;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 3/3 net] dmaengine: ti: k3-udma-glue: clean up k3_udma_glue_tx_get_irq() return
2023-09-26 14:06 ` [PATCH 3/3 net] dmaengine: ti: k3-udma-glue: clean up k3_udma_glue_tx_get_irq() return Dan Carpenter
@ 2023-09-26 18:46 ` Roger Quadros
2023-09-28 7:50 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Roger Quadros @ 2023-09-26 18:46 UTC (permalink / raw)
To: Dan Carpenter, Peter Ujfalusi
Cc: Vinod Koul, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Siddharth Vadapalli, Grygorii Strashko,
MD Danish Anwar, Andrew Lunn, Vignesh Raghavendra, dmaengine,
linux-kernel, netdev, kernel-janitors
On 26/09/2023 17:06, Dan Carpenter wrote:
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 3/3 net] dmaengine: ti: k3-udma-glue: clean up k3_udma_glue_tx_get_irq() return
2023-09-26 14:06 ` [PATCH 3/3 net] dmaengine: ti: k3-udma-glue: clean up k3_udma_glue_tx_get_irq() return Dan Carpenter
2023-09-26 18:46 ` Roger Quadros
@ 2023-09-28 7:50 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2023-09-28 7:50 UTC (permalink / raw)
To: Dan Carpenter
Cc: Peter Ujfalusi, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Siddharth Vadapalli, Roger Quadros,
Grygorii Strashko, MD Danish Anwar, Andrew Lunn,
Vignesh Raghavendra, dmaengine, linux-kernel, netdev,
kernel-janitors
On 26-09-23, 17:06, Dan Carpenter wrote:
> 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.
Acked-by: Vinod Koul <vkoul@kernel.org>
--
~Vinod
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-28 7:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4c2073cc-e7ef-4f16-9655-1a46cfed9fe9@moroto.mountain>
2023-09-26 14:06 ` [PATCH 3/3 net] dmaengine: ti: k3-udma-glue: clean up k3_udma_glue_tx_get_irq() return Dan Carpenter
2023-09-26 18:46 ` Roger Quadros
2023-09-28 7:50 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).