mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] clk: imx: clk-pllv2: Fix unitialized variable warning
@ 2024-08-14  8:33 Sascha Hauer
  2024-08-14  8:46 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2024-08-14  8:33 UTC (permalink / raw)
  To: Barebox List

__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@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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] clk: imx: clk-pllv2: Fix unitialized variable warning
  2024-08-14  8:33 [PATCH] clk: imx: clk-pllv2: Fix unitialized variable warning Sascha Hauer
@ 2024-08-14  8:46 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-08-14  8:46 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer


On Wed, 14 Aug 2024 10:33:12 +0200, Sascha Hauer wrote:
> __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.
> 
> 

Applied, thanks!

[1/1] clk: imx: clk-pllv2: Fix unitialized variable warning
      https://git.pengutronix.de/cgit/barebox/commit/?id=8632a853a613 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-14  8:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-14  8:33 [PATCH] clk: imx: clk-pllv2: Fix unitialized variable warning Sascha Hauer
2024-08-14  8:46 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox