db8500: fix build error due to undeclared i variable
PATCH 1/1 db8500: fix build error due to undeclared i variable
The variable i is removed by commit ded8433
"[CPUFREQ] db8500: remove unneeded for loop iteration over freq_table", but current code to print available frequencies still uses the i variable. Thus add the i variable back to fix below buld error:
CC drivers/cpufreq/db8500-cpufreq.odrivers/cpufreq/db8500-cpufreq.c: In function 'db8500_cpufreq_init':drivers/cpufreq/db8500-cpufreq.c:123: error: 'i' undeclared (first use in this function) drivers/cpufreq/db8500-cpufreq.c:123: error: (Each undeclared identifier is reported only once drivers/cpufreq/db8500-cpufreq.c:123: error: for each function it appears in.) make[2]: *** [drivers/cpufreq/db8500-cpufreq.o] Error 1
make[1]: *** [drivers/cpufreq] Error 2
make: *** [drivers] Error 2
This patch also fixes using uninitialized i variable as array index.
--- drivers/cpufreq/db8500-cpufreq.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/cpufreq/db8500-cpufreq.c +3 -3
@@ -109,7 +109,7 @@ static unsigned int db8500_cpufreq_getspeed(unsigned int cpu)static int __cpuinit db8500_cpufreq_init (struct cpufreq_policy *policy) { -int res; +int i, res;BUILD_BUG_ON (ARRAY_SIZE (idx2opp) +1 !=ARRAY_SIZE (freq_table));
@@ -120,8 +120,8 @@ static int __cpuinit db8500_cpufreq_init(struct cpufreq_policy *policy) freq_table[3 ].frequency =1000000 ; }pr_info ("db8500-cpufreq : Available frequencies:\n" ); -while (freq_table[i].frequency !=CPUFREQ_TABLE_END ) -pr_info (" %d Mhz\n" , freq_table[i++].frequency/1000 ); +for (i =0 ; freq_table[i].frequency !=CPUFREQ_TABLE_END ; i++) +pr_info (" %d Mhz\n" , freq_table[i].frequency/1000 );/* get policy fields based on the table */ res =cpufreq_frequency_table_cpuinfo (policy, freq_table);
Signature · 1 line
1.7.5.4
Quoted 4 lines · Axel Lin
The variable i is removed by commit ded8433
"[CPUFREQ] db8500: remove unneeded for loop iteration overfreq_table", but current code to print available frequencies still uses the i variable. Thus add the i variable back to fix below buld error:
How could I miss this? :-(
Thanks,
Linus Walleij