[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <693c433a-cf72-4938-a1aa-58af2ff89479@stanley.mountain>
Date: Thu, 18 Jul 2024 13:32:56 -0500
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Lorenzo Bianconi <lorenzo@...nel.org>
Cc: Felix Fietkau <nbd@....name>, Sean Wang <sean.wang@...iatek.com>,
Mark Lee <Mark-MC.Lee@...iatek.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
linux-mediatek@...ts.infradead.org, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH net-next] net: airoha: Fix forever loops in error handling
These loops have ++ where -- was intended. It would end up looping until
the system died.
Fixes: 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC")
Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
drivers/net/ethernet/mediatek/airoha_eth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mediatek/airoha_eth.c b/drivers/net/ethernet/mediatek/airoha_eth.c
index 7967a92803c2..698835dc6da0 100644
--- a/drivers/net/ethernet/mediatek/airoha_eth.c
+++ b/drivers/net/ethernet/mediatek/airoha_eth.c
@@ -977,7 +977,7 @@ static int airoha_set_gdm_ports(struct airoha_eth *eth, bool enable)
return 0;
error:
- for (i--; i >= 0; i++)
+ while (--i >= 0)
airoha_set_gdm_port(eth, port_list[i], false);
return err;
@@ -2431,7 +2431,7 @@ static netdev_tx_t airoha_dev_xmit(struct sk_buff *skb,
return NETDEV_TX_OK;
error_unmap:
- for (i--; i >= 0; i++)
+ while (--i >= 0)
dma_unmap_single(dev->dev.parent, q->entry[i].dma_addr,
q->entry[i].dma_len, DMA_TO_DEVICE);
--
2.43.0
Powered by blists - more mailing lists