[CPUFREQ] powernow-k8: Don't try to transition if the pstate is incorrect
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Thu, 16 Jun 2011 19:36:40 +0000 (15:36 -0400)
committerDave Jones <davej@redhat.com>
Thu, 16 Jun 2011 20:31:13 +0000 (16:31 -0400)
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>
drivers/cpufreq/powernow-k8.c

index 287c56f6749aeed8192a57a980d7dc8f6111eb43..bce576d7478ed41f9b69ac727cc5d143d850bb83 100644 (file)
@@ -1104,7 +1104,8 @@ static int transition_frequency_pstate(struct powernow_k8_data *data,
        /* get MSR index for hardware pstate transition */
        pstate = index & HW_PSTATE_MASK;
        if (pstate > data->max_hw_pstate)
-               return 0;
+               return -EINVAL;
+
        freqs.old = find_khz_freq_from_pstate(data->powernow_table,
                        data->currpstate);
        freqs.new = find_khz_freq_from_pstate(data->powernow_table, pstate);