[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250722062716.29590-2-yangtiezhu@loongson.cn>
Date: Tue, 22 Jul 2025 14:27:15 +0800
From: Tiezhu Yang <yangtiezhu@...ngson.cn>
To: Andrew Lunn <andrew+netdev@...n.ch>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Cc: netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH net-next 1/2] net: stmmac: Return early if invalid in loongson_dwmac_fix_reset()
If the DMA_BUS_MODE_SFT_RESET bit is 1 before software reset,
there is no need to do anything for this abnormal case, just
return -EINVAL immediately in loongson_dwmac_fix_reset().
Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
index e1591e6217d4..6d10077666c7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
@@ -513,6 +513,9 @@ static int loongson_dwmac_fix_reset(void *priv, void __iomem *ioaddr)
{
u32 value = readl(ioaddr + DMA_BUS_MODE);
+ if (value & DMA_BUS_MODE_SFT_RESET)
+ return -EINVAL;
+
value |= DMA_BUS_MODE_SFT_RESET;
writel(value, ioaddr + DMA_BUS_MODE);
--
2.42.0
Powered by blists - more mailing lists