diff options
author | Dave Jones <davej@redhat.com> | 2009-06-01 12:29:55 -0400 |
---|---|---|
committer | Dave Jones <davej@redhat.com> | 2009-06-15 11:49:42 -0400 |
commit | 931db6a32dbfaad627e89d0524979ce9cb894691 (patch) | |
tree | 50fd6fd41f8aca40ce95314fb16d33602859137f /arch | |
parent | 51555c0e91160f6d4c6c1cb7a44d20ea346aed08 (diff) |
[CPUFREQ] Clean up convoluted code in arch/x86/kernel/tsc.c:time_cpufreq_notifier()
Christoph Hellwig noticed the following potential uninitialised use:
> arch/x86/kernel/tsc.c: In function 'time_cpufreq_notifier':
> arch/x86/kernel/tsc.c:634: warning: 'dummy' may be used uninitialized in this function
>
> where we do have CONFIG_SMP set, freq->flags & CPUFREQ_CONST_LOOPS is
> true and ref_freq is false.
It seems plausable, though the circumstances for hitting it are really low.
Nearly all SMP capable cpufreq drivers set CPUFREQ_CONST_LOOPS.
powernow-k8 is really the only exception. The older CPUs were typically
only ever UP. (powernow-k7 never supported SMP for eg)
It's worth fixing regardless, as it cleans up the code.
Fix possible uninitialized use of dummy, by just removing it,
and making the setting of lpj more obvious.
Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/tsc.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index 3e1c057e98fe..3fbd3206eccf 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -631,17 +631,15 @@ static int time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, | |||
631 | void *data) | 631 | void *data) |
632 | { | 632 | { |
633 | struct cpufreq_freqs *freq = data; | 633 | struct cpufreq_freqs *freq = data; |
634 | unsigned long *lpj, dummy; | 634 | unsigned long *lpj; |
635 | 635 | ||
636 | if (cpu_has(&cpu_data(freq->cpu), X86_FEATURE_CONSTANT_TSC)) | 636 | if (cpu_has(&cpu_data(freq->cpu), X86_FEATURE_CONSTANT_TSC)) |
637 | return 0; | 637 | return 0; |
638 | 638 | ||
639 | lpj = &dummy; | 639 | lpj = &boot_cpu_data.loops_per_jiffy; |
640 | if (!(freq->flags & CPUFREQ_CONST_LOOPS)) | ||
641 | #ifdef CONFIG_SMP | 640 | #ifdef CONFIG_SMP |
641 | if (!(freq->flags & CPUFREQ_CONST_LOOPS)) | ||
642 | lpj = &cpu_data(freq->cpu).loops_per_jiffy; | 642 | lpj = &cpu_data(freq->cpu).loops_per_jiffy; |
643 | #else | ||
644 | lpj = &boot_cpu_data.loops_per_jiffy; | ||
645 | #endif | 643 | #endif |
646 | 644 | ||
647 | if (!ref_freq) { | 645 | if (!ref_freq) { |