[CPUFREQ] Fix the bug in duplicate freq elimination code in acpi-cpufreq
authorVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Tue, 14 Nov 2006 01:47:44 +0000 (17:47 -0800)
committerDave Jones <davej@redhat.com>
Tue, 12 Dec 2006 22:20:50 +0000 (17:20 -0500)
Fix the bug in duplicate states elimination in acpi-cpufreq.

Bug: Due to duplicate state elimiation in the loop earlier, the number
of valid_states can be less than perf->state_count, in which case
freq_table was ending up with some garbage/uninitialized entries
in the table.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
From:  Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Dave Jones <davej@redhat.com>
arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c

index 60d20cf427aa19748f904c9626950b7d5ce0dac0..18f4715c655d18a2a453558ac546c9154f93902e 100644 (file)
@@ -693,7 +693,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
                    perf->states[i].core_frequency * 1000;
                valid_states++;
        }
-       data->freq_table[perf->state_count].frequency = CPUFREQ_TABLE_END;
+       data->freq_table[valid_states].frequency = CPUFREQ_TABLE_END;
 
        result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table);
        if (result)