[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210415083757.1807538-1-colin.king@canonical.com>
Date: Thu, 15 Apr 2021 09:37:57 +0100
From: Colin King <colin.king@...onical.com>
To: Giuseppe Cavallaro <peppe.cavallaro@...com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Jose Abreu <joabreu@...opsys.com>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
netdev@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][next] net: stmmac: replace redundant comparison with true
From: Colin Ian King <colin.king@...onical.com>
The comparison of the u32 variable queue with <= zero is always true
since an unsigned can never be negative. Replace the conditional
check with the boolean true to simplify the code. The while loop
will terminate because of the zero check on queue before queue is
decremented.
Addresses-Coverity: ("Unsigned compared against 0")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index e3e22200a4fd..6e5b4c4b375c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1673,7 +1673,7 @@ static void stmmac_reinit_rx_buffers(struct stmmac_priv *priv)
return;
err_reinit_rx_buffers:
- while (queue >= 0) {
+ while (true) {
dma_free_rx_skbufs(priv, queue);
if (queue == 0)
@@ -1781,7 +1781,7 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags)
return 0;
err_init_rx_buffers:
- while (queue >= 0) {
+ while (true) {
struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
if (rx_q->xsk_pool)
--
2.30.2
Powered by blists - more mailing lists