[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <34770474-0345-4223-9c11-9039b74d03b4@moroto.mountain>
Date: Tue, 26 Sep 2023 17:05:59 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Roger Quadros <rogerq@...com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
MD Danish Anwar <danishanwar@...com>, Andrew Lunn <andrew@...n.ch>,
Grygorii Strashko <grygorii.strashko@...com>,
Vignesh Raghavendra <vigneshr@...com>, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH 2/3 net] net: ti: icssg-prueth: Fix signedness bug in
prueth_init_tx_chns()
The "tx_chn->irq" variable is unsigned so the error checking does not
work correctly.
Fixes: 128d5874c082 ("net: ti: icssg-prueth: Add ICSSG ethernet driver")
Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
drivers/net/ethernet/ti/icssg/icssg_prueth.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
index 92b13057d4de..89c0c3449d98 100644
--- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c
+++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c
@@ -316,12 +316,14 @@ static int prueth_init_tx_chns(struct prueth_emac *emac)
goto fail;
}
- tx_chn->irq = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
- if (tx_chn->irq <= 0) {
- ret = -EINVAL;
+ ret = k3_udma_glue_tx_get_irq(tx_chn->tx_chn);
+ if (ret <= 0) {
+ if (!ret)
+ ret = -EINVAL;
netdev_err(ndev, "failed to get tx irq\n");
goto fail;
}
+ tx_chn->irq = ret;
snprintf(tx_chn->name, sizeof(tx_chn->name), "%s-tx%d",
dev_name(dev), tx_chn->id);
--
2.39.2
Powered by blists - more mailing lists