[PATCH] clk: mediatek: fix cppcheck error for uninitialized variable


Mon Dec 25 07:28:04 PST 2023


From: Kishan Dudhatra <kishan.dudhatra at siliconsignals.io>

cppcheck reports below warning

clk/mediatek/clk-fhctl.c:206:27:
error: Uninitialized variable: pll_postdiv [uninitvar]
if (postdiv && postdiv < pll_postdiv)

This is due to uninitialization of variable pll_postdiv,
which is now initialized as part of this patch.

Signed-off-by: Kishan Dudhatra <kishan.dudhatra at siliconsignals.io>

diff --git a/drivers/clk/mediatek/clk-fhctl.c b/drivers/clk/mediatek/clk-fhctl.c
index 33b6ad8fdc2e..b0e71e4fd938 100644
--- a/drivers/clk/mediatek/clk-fhctl.c
+++ b/drivers/clk/mediatek/clk-fhctl.c
@@ -186,7 +186,7 @@ static int fhctl_hopping(struct mtk_fh *fh, unsigned int new_dds,
 	struct fh_pll_regs *regs = &fh->regs;
 	struct mtk_clk_pll *pll = &fh->clk_pll;
 	spinlock_t *lock = fh->lock;
-	unsigned int pll_postdiv;
+	unsigned int pll_postdiv = 0;
 	unsigned long flags = 0;
 	int ret;
 
-- 
2.25.1




More information about the linux-arm-kernel mailing list