27 lines
979 B
Diff
27 lines
979 B
Diff
From 156278367fd2c0863dc06f9a7df0a654ae336726 Mon Sep 17 00:00:00 2001
|
|
From: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
|
Date: Wed, 5 Feb 2025 11:25:21 +0000
|
|
Subject: 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: e8f555daacd3 ("cpufreq/amd-pstate: fix setting policy current frequency value")
|
|
Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
|
|
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
|
|
---
|
|
drivers/cpufreq/amd-pstate.c | 3 +++
|
|
1 file changed, 3 insertions(+)
|
|
|
|
--- a/drivers/cpufreq/amd-pstate.c
|
|
+++ b/drivers/cpufreq/amd-pstate.c
|
|
@@ -551,6 +551,9 @@ static void amd_pstate_update(struct amd
|
|
struct cpufreq_policy *policy = cpufreq_cpu_get(cpudata->cpu);
|
|
u8 nominal_perf = READ_ONCE(cpudata->nominal_perf);
|
|
|
|
+ if (!policy)
|
|
+ return;
|
|
+
|
|
des_perf = clamp_t(u8, des_perf, min_perf, max_perf);
|
|
|
|
policy->cur = perf_to_freq(cpudata, des_perf);
|