Skip to content

Commit bb87be2

Browse files
gautshenrafaeljw
authored andcommitted
cpufreq/amd-pstate: Fix the return value of amd_pstate_fast_switch()
cpufreq_driver->fast_switch() callback expects a frequency as a return value. amd_pstate_fast_switch() was returning the return value of amd_pstate_update_freq(), which only indicates a success or failure. Fix this by making amd_pstate_fast_switch() return the target_freq when the call to amd_pstate_update_freq() is successful, and return the current frequency from policy->cur when the call to amd_pstate_update_freq() is unsuccessful. Fixes: 4badf2e ("cpufreq: amd-pstate: Add ->fast_switch() callback") Acked-by: Huang Rui <[email protected]> Reviewed-by: Wyes Karny <[email protected]> Reviewed-by: Perry Yuan <[email protected]> Cc: 6.4+ <[email protected]> # v6.4+ Signed-off-by: Gautham R. Shenoy <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 6ba21d0 commit bb87be2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,9 @@ static int amd_pstate_target(struct cpufreq_policy *policy,
518518
static unsigned int amd_pstate_fast_switch(struct cpufreq_policy *policy,
519519
unsigned int target_freq)
520520
{
521-
return amd_pstate_update_freq(policy, target_freq, true);
521+
if (!amd_pstate_update_freq(policy, target_freq, true))
522+
return target_freq;
523+
return policy->cur;
522524
}
523525

524526
static void amd_pstate_adjust_perf(unsigned int cpu,

0 commit comments

Comments
 (0)