Skip to content

Commit 426db24

Browse files
dhananjay-AMDsuperm1
authored andcommitted
cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update
Check if policy is NULL before dereferencing it in amd_pstate_update. Fixes: e8f555d ("cpufreq/amd-pstate: fix setting policy current frequency value") Signed-off-by: Dhananjay Ugwekar <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Reviewed-by: Gautham R. Shenoy <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mario Limonciello <[email protected]>
1 parent b899434 commit 426db24

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,9 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u8 min_perf,
551551
struct cpufreq_policy *policy = cpufreq_cpu_get(cpudata->cpu);
552552
u8 nominal_perf = READ_ONCE(cpudata->nominal_perf);
553553

554+
if (!policy)
555+
return;
556+
554557
des_perf = clamp_t(u8, des_perf, min_perf, max_perf);
555558

556559
policy->cur = perf_to_freq(cpudata, des_perf);

0 commit comments

Comments
 (0)