[PATCH 2/2] ARM: i.MX9: initialize max_speed in imx9_cpu_speed_grade_hz

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Aug 31 07:44:19 PDT 2026


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 at 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




More information about the barebox mailing list