[PATCH] clk: imx: clk-pllv2: Fix unitialized variable warning
Sascha Hauer
s.hauer at pengutronix.de
Wed Aug 14 01:33:12 PDT 2024
__clk_pllv2_set_rate() might return with an error in which case some
of the variables are used uninitialized. Check for an error like the
Kernel does.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/clk/imx/clk-pllv2.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/imx/clk-pllv2.c b/drivers/clk/imx/clk-pllv2.c
index d997e465d5..bb99555e22 100644
--- a/drivers/clk/imx/clk-pllv2.c
+++ b/drivers/clk/imx/clk-pllv2.c
@@ -185,8 +185,12 @@ static long clk_pllv2_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *prate)
{
u32 dp_op, dp_mfd, dp_mfn;
+ int ret;
+
+ ret = __clk_pllv2_set_rate(rate, *prate, &dp_op, &dp_mfd, &dp_mfn);
+ if (ret)
+ return ret;
- __clk_pllv2_set_rate(rate, *prate, &dp_op, &dp_mfd, &dp_mfn);
return __clk_pllv2_recalc_rate(*prate, MXC_PLL_DP_CTL_DPDCK0_2_EN,
dp_op, dp_mfd, dp_mfn);
}
--
2.39.2
More information about the barebox
mailing list