[PATCH] cpufreq: spear: Fix uninitialized variable "i"

From: Rob Herring (Arm)
Date: Mon Aug 05 2024 - 16:21:14 EST


The refactoring in commit dca2ef2b7d91 ("cpufreq: spear: Use
of_property_for_each_u32() instead of open coding") left "i"
uninitialized. Initialize it to 0.

Note that gcc doesn't detect this, only clang does.

Fixes: dca2ef2b7d91 ("cpufreq: spear: Use of_property_for_each_u32() instead of open coding")
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202408030418.gnJDcCpm-lkp@xxxxxxxxx/
Signed-off-by: Rob Herring (Arm) <robh@xxxxxxxxxx>
---
drivers/cpufreq/spear-cpufreq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c
index 4d28147c23f1..f8c16699a68d 100644
--- a/drivers/cpufreq/spear-cpufreq.c
+++ b/drivers/cpufreq/spear-cpufreq.c
@@ -173,7 +173,7 @@ static int spear_cpufreq_probe(struct platform_device *pdev)
struct device_node *np;
struct cpufreq_frequency_table *freq_tbl;
u32 val;
- int cnt, i, ret;
+ int cnt, i = 0, ret;

np = of_cpu_device_node_get(0);
if (!np) {
--
2.43.0