]> Pileus Git - ~andy/linux/commitdiff
cpufreq: pxa2xx: initialize variables
authorArnd Bergmann <arnd@arndb.de>
Thu, 25 Apr 2013 17:28:57 +0000 (19:28 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 25 Apr 2013 18:11:14 +0000 (20:11 +0200)
gcc-3.8 correctly found that the variables set by find_freq_tables()
are not initialized if this function is called on something other
than a pxa2xx or pxa3xx:

pxa2xx-cpufreq.c: In function 'pxa_verify_policy':
pxa2xx-cpufreq.c:272:6: warning: 'pxa_freqs_table' may be used uninitialized in this function [-Wmaybe-uninitialized]
pxa2xx-cpufreq.c: In function 'pxa_set_target':
pxa2xx-cpufreq.c:345:23: warning: 'pxa_freq_settings' may be used uninitialized in this function [-Wmaybe-uninitialized]

Rather than adding a bogus initialization that would let us
get a little further before crashing, add an explicit BUG().
We know that this code is designed to run on only these cpus,
so this will fix the build warning and give a more helpful
diagnostic if the code ever changes to run on other machines.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/pxa2xx-cpufreq.c

index fe4c55b38ec33d6fa9f771d42e989234bbaa3689..9e5bc8e388a0239ee5061fdd427c016e8abf68b5 100644 (file)
@@ -221,10 +221,11 @@ static void find_freq_tables(struct cpufreq_frequency_table **freq_table,
                        *pxa_freqs = pxa255_turbo_freqs;
                        *freq_table = pxa255_turbo_freq_table;
                }
-       }
-       if (cpu_is_pxa27x()) {
+       } else if (cpu_is_pxa27x()) {
                *pxa_freqs = pxa27x_freqs;
                *freq_table = pxa27x_freq_table;
+       } else {
+               BUG();
        }
 }