Message ID | 20241209041951.3426114-1-jianqi.ren.cn@windriver.com |
---|---|
State | Superseded |
Headers | show |
Series | [6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value | expand |
Hi! If I'm not mistaken, backport should be accepted to a newer stable version 6.6 first. Also I’ve already sent it [1]. However, I haven't received an answer yet. [1] https://lore.kernel.org/lkml/20241106182000.40167-2-abelova@astralinux.ru/ Anastasia Belova
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 90dcf26f0973..106aef210003 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -309,9 +309,14 @@ static void amd_pstate_adjust_perf(unsigned int cpu, unsigned long max_perf, min_perf, des_perf, cap_perf, lowest_nonlinear_perf, max_freq; struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); - struct amd_cpudata *cpudata = policy->driver_data; + struct amd_cpudata *cpudata; unsigned int target_freq; + if (!policy) + return; + + cpudata = policy->driver_data; + cap_perf = READ_ONCE(cpudata->highest_perf); lowest_nonlinear_perf = READ_ONCE(cpudata->lowest_nonlinear_perf); max_freq = READ_ONCE(cpudata->max_freq);