From: Dan Carpenter <dan.carpenter@linaro.org>
To: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Cc: Vinod Koul <vkoul@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Siddharth Vadapalli <s-vadapalli@ti.com>,
Roger Quadros <rogerq@kernel.org>,
Grygorii Strashko <grygorii.strashko@ti.com>,
MD Danish Anwar <danishanwar@ti.com>,
Andrew Lunn <andrew@lunn.ch>,
Vignesh Raghavendra <vigneshr@ti.com>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH 3/3 net] dmaengine: ti: k3-udma-glue: clean up k3_udma_glue_tx_get_irq() return
Date: Tue, 26 Sep 2023 17:06:58 +0300 [thread overview]
Message-ID: <bf2cee83-ca8d-4d95-9e83-843a2ad63959@moroto.mountain> (raw)
In-Reply-To: <4c2073cc-e7ef-4f16-9655-1a46cfed9fe9@moroto.mountain>
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
next prev parent reply other threads:[~2023-09-26 14:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-26 14:04 [PATCH 1/3 net] net: ethernet: ti: am65-cpsw: Fix error code in am65_cpsw_nuss_init_tx_chns() Dan Carpenter
2023-09-26 14:05 ` [PATCH 2/3 net] net: ti: icssg-prueth: Fix signedness bug in prueth_init_tx_chns() Dan Carpenter
2023-09-27 11:29 ` Roger Quadros
2023-09-26 14:06 ` Dan Carpenter [this message]
2023-09-26 18:46 ` [PATCH 3/3 net] dmaengine: ti: k3-udma-glue: clean up k3_udma_glue_tx_get_irq() return Roger Quadros
2023-09-28 7:50 ` Vinod Koul
2023-09-26 18:44 ` [PATCH 1/3 net] net: ethernet: ti: am65-cpsw: Fix error code in am65_cpsw_nuss_init_tx_chns() Roger Quadros
2023-10-04 9:40 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bf2cee83-ca8d-4d95-9e83-843a2ad63959@moroto.mountain \
--to=dan.carpenter@linaro.org \
--cc=andrew@lunn.ch \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=dmaengine@vger.kernel.org \
--cc=edumazet@google.com \
--cc=grygorii.strashko@ti.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=peter.ujfalusi@gmail.com \
--cc=rogerq@kernel.org \
--cc=s-vadapalli@ti.com \
--cc=vigneshr@ti.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox