Commit fbb5b89eabea5ae7d621b7861863159560d8faa4

Authored by Konrad Rzeszutek Wilk
Committed by Dave Jones
1 parent a9d3d20680

[CPUFREQ] powernow-k8: Don't try to transition if the pstate is incorrect

This patch augments the pstate transition code to error out
(instead of returning 0) when an incorrect pstate is provided.

Suggested-by: Borislav Petkov <bp@alien8.de>
CC: andre.przywara@amd.com
CC: Mark.Langsdorf@amd.com
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Dave Jones <davej@redhat.com>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

drivers/cpufreq/powernow-k8.c
... ... @@ -1104,7 +1104,8 @@
1104 1104 /* get MSR index for hardware pstate transition */
1105 1105 pstate = index & HW_PSTATE_MASK;
1106 1106 if (pstate > data->max_hw_pstate)
1107   - return 0;
  1107 + return -EINVAL;
  1108 +
1108 1109 freqs.old = find_khz_freq_from_pstate(data->powernow_table,
1109 1110 data->currpstate);
1110 1111 freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);