net: ethernet: mtk_eth_soc: fix error checking in mtk_mac_config()
Subsystems (4)
PATCH v2 1/1 net: ethernet: mtk_eth_soc: fix error checking in mtk_mac_config()
From: Tom Rix <[email protected]>
Clang static analysis reports this problem mtk_eth_soc.c:394:7: warning: Branch condition evaluates
to a garbage value
if (err)
^~~err is not initialized and only conditionally set. So intitialize err.
---
v2: change to initializing
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +1 -1
@@ -267,7 +267,7 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode, phylink_config);struct mtk_eth *eth = mac->hw;u32 mcr_cur, mcr_new, sid, i; -int val, ge_mode, err; +int val, ge_mode, err =0 ;/* MT76x8 has no hardware settings between for the MAC */ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628) &&
Signature · 1 line
2.26.3
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:
Quoted 9 lines · On Sat, 15 Jan 2022 09:49:18 -0800 you wrote:
From: Tom Rix <[email protected]>
Clang static analysis reports this problem mtk_eth_soc.c:394:7: warning: Branch condition evaluates
to a garbage valueif (err) ^~~[...]
Here is the summary with links:
- [v2] net: ethernet: mtk_eth_soc: fix error checking in mtk_mac_config()
https://git.kernel.org/netdev/net/c/214b3369ab9b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html