summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rix <trix@redhat.com>2022-01-15 20:49:18 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-01-27 12:54:35 +0300
commit819e76bc572e373db88956ddc219e9976b16a10f (patch)
tree10cbd5a05a966619a32dc3f6ff279c44e676cc3e
parent4691c9f047a809693ac4efbc441e29b7dbb0cdca (diff)
downloadlinux-819e76bc572e373db88956ddc219e9976b16a10f.tar.xz
net: ethernet: mtk_eth_soc: fix error checking in mtk_mac_config()
commit 214b3369ab9b0a6f28d6c970220c209417edbc65 upstream. 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. Fixes: 7e538372694b ("net: ethernet: mediatek: Re-add support SGMII") Signed-off-by: Tom Rix <trix@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/ethernet/mediatek/mtk_eth_soc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index a2d3f04a9ff2..7d7dc0754a3a 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -215,7 +215,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) &&