Commit 0f71d95b authored by Kurt Roeckx's avatar Kurt Roeckx Committed by Greg Kroah-Hartman

Fix NULL ptr regression in powernow-k8

commit f0adb134 upstream.

Fixes bugzilla #13780

From: Kurt Roeckx <kurt@roeckx.be>
Signed-off-by: default avatarDave Jones <davej@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6a660289
...@@ -605,9 +605,10 @@ static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, ...@@ -605,9 +605,10 @@ static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst,
return 0; return 0;
} }
static void invalidate_entry(struct powernow_k8_data *data, unsigned int entry) static void invalidate_entry(struct cpufreq_frequency_table *powernow_table,
unsigned int entry)
{ {
data->powernow_table[entry].frequency = CPUFREQ_ENTRY_INVALID; powernow_table[entry].frequency = CPUFREQ_ENTRY_INVALID;
} }
static void print_basics(struct powernow_k8_data *data) static void print_basics(struct powernow_k8_data *data)
...@@ -914,13 +915,13 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data, ...@@ -914,13 +915,13 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data,
"bad value %d.\n", i, index); "bad value %d.\n", i, index);
printk(KERN_ERR PFX "Please report to BIOS " printk(KERN_ERR PFX "Please report to BIOS "
"manufacturer\n"); "manufacturer\n");
invalidate_entry(data, i); invalidate_entry(powernow_table, i);
continue; continue;
} }
rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi); rdmsr(MSR_PSTATE_DEF_BASE + index, lo, hi);
if (!(hi & HW_PSTATE_VALID_MASK)) { if (!(hi & HW_PSTATE_VALID_MASK)) {
dprintk("invalid pstate %d, ignoring\n", index); dprintk("invalid pstate %d, ignoring\n", index);
invalidate_entry(data, i); invalidate_entry(powernow_table, i);
continue; continue;
} }
...@@ -970,7 +971,7 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data, ...@@ -970,7 +971,7 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data,
/* verify frequency is OK */ /* verify frequency is OK */
if ((freq > (MAX_FREQ * 1000)) || (freq < (MIN_FREQ * 1000))) { if ((freq > (MAX_FREQ * 1000)) || (freq < (MIN_FREQ * 1000))) {
dprintk("invalid freq %u kHz, ignoring\n", freq); dprintk("invalid freq %u kHz, ignoring\n", freq);
invalidate_entry(data, i); invalidate_entry(powernow_table, i);
continue; continue;
} }
...@@ -978,7 +979,7 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data, ...@@ -978,7 +979,7 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data,
* BIOSs are using "off" to indicate invalid */ * BIOSs are using "off" to indicate invalid */
if (vid == VID_OFF) { if (vid == VID_OFF) {
dprintk("invalid vid %u, ignoring\n", vid); dprintk("invalid vid %u, ignoring\n", vid);
invalidate_entry(data, i); invalidate_entry(powernow_table, i);
continue; continue;
} }
...@@ -997,7 +998,7 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data, ...@@ -997,7 +998,7 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data,
dprintk("double low frequency table entry, " dprintk("double low frequency table entry, "
"ignoring it.\n"); "ignoring it.\n");
invalidate_entry(data, i); invalidate_entry(powernow_table, i);
continue; continue;
} else } else
cntlofreq = i; cntlofreq = i;
...@@ -1009,7 +1010,7 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data, ...@@ -1009,7 +1010,7 @@ static int fill_powernow_table_fidvid(struct powernow_k8_data *data,
(unsigned int) (unsigned int)
(data->acpi_data.states[i].core_frequency (data->acpi_data.states[i].core_frequency
* 1000)); * 1000));
invalidate_entry(data, i); invalidate_entry(powernow_table, i);
continue; continue;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment