mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] clk: k3: pll: initialize success flag in ti_pll_wait_for_lock
@ 2026-08-31 14:44 Ahmad Fatoum
  2026-08-31 14:44 ` [PATCH 2/2] ARM: i.MX9: initialize max_speed in imx9_cpu_speed_grade_hz Ahmad Fatoum
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-08-31 14:44 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

When built with clang, we run into following warning (turned error with
CONFIG_WERROR):

  drivers/clk/k3/pll.c:100:14: error: variable 'success' is used uninitialized
  whenever 'for' loop exits because its condition is false [-Werror,-Wsometimes-uninitialized]

Initialize the variable to fix.

Fixes: 657d39593b2f ("clk: add K3 clk driver")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/clk/k3/pll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/k3/pll.c b/drivers/clk/k3/pll.c
index c76a91b1d094..ef59da3d9dbc 100644
--- a/drivers/clk/k3/pll.c
+++ b/drivers/clk/k3/pll.c
@@ -95,7 +95,7 @@ static int ti_pll_wait_for_lock(struct ti_pll_clk *pll)
 	int i;
 	u32 pllfm;
 	u32 pll_type;
-	int success;
+	int success = 0;
 
 	for (i = 0; i < 100000; i++) {
 		stat = readl(pll->reg + PLL_16FFT_STAT);
-- 
2.47.3




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

* [PATCH 2/2] ARM: i.MX9: initialize max_speed in imx9_cpu_speed_grade_hz
  2026-08-31 14:44 [PATCH 1/2] clk: k3: pll: initialize success flag in ti_pll_wait_for_lock Ahmad Fatoum
@ 2026-08-31 14:44 ` Ahmad Fatoum
  0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2026-08-31 14:44 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

When built with clang, following warning is produced:

  arch/arm/mach-imx/imx9.c:36:6: error: variable 'max_speed' is used
  uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]

The read is not reachable today, as the only caller chain is
imx_init() -> imx93_init() -> imx93_set_arm_clock() and imx_init() enters
it only under cpu_is_mx93(), but that stops being true as soon as another
i.MX9 SoC is added.

Initialize it to U32_MAX, so the fused speed grade is left as-is when
no maximum is known.

Fixes: 37912154d88a ("ARM: initial i.MX9 support")
Assisted-by: Claude:fable-5
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/mach-imx/imx9.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/imx9.c b/arch/arm/mach-imx/imx9.c
index ada4048d4ca0..4344de260238 100644
--- a/arch/arm/mach-imx/imx9.c
+++ b/arch/arm/mach-imx/imx9.c
@@ -24,7 +24,7 @@ static u32 imx9_read_shadow_fuse(int fuse)
 
 static u32 imx9_cpu_speed_grade_hz(void)
 {
-	u32 speed, max_speed;
+	u32 speed, max_speed = U32_MAX;
 	u32 val;
 
 	val = imx9_read_shadow_fuse(19);
-- 
2.47.3




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

end of thread, other threads:[~2026-08-31 14:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-31 14:44 [PATCH 1/2] clk: k3: pll: initialize success flag in ti_pll_wait_for_lock Ahmad Fatoum
2026-08-31 14:44 ` [PATCH 2/2] ARM: i.MX9: initialize max_speed in imx9_cpu_speed_grade_hz Ahmad Fatoum

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