Skip to content

Commit be473f0

Browse files
Pengjie Zhangrafaeljw
authored andcommitted
ACPI: CPPC: Fix uninitialized ref variable in cppc_get_perf_caps()
Commit 8505bfb ("ACPI: CPPC: Move reference performance to capabilities") introduced a logical error when retrieving the reference performance. On platforms lacking the reference performance register, the fallback logic leaves the local 'ref' variable uninitialized (0). This causes the subsequent sanity check to incorrectly return -EFAULT, breaking amd_pstate initialization. Fix this by assigning 'ref = nom' in the fallback path. Fixes: 8505bfb ("ACPI: CPPC: Move reference performance to capabilities") Reported-by: Nathan Chancellor <nathan@kernel.org> Closes: https://lore.kernel.org/all/20260310003026.GA2639793@ax162/ Tested-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Pengjie Zhang <zhangpengjie2@huawei.com> [ rjw: Subject tweak ] Link: https://patch.msgid.link/20260311071334.1494960-1-zhangpengjie2@huawei.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 8505bfb commit be473f0

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

drivers/acpi/cppc_acpi.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,12 +1407,11 @@ int cppc_get_perf_caps(int cpunum, struct cppc_perf_caps *perf_caps)
14071407
* If reference perf register is not supported then we should
14081408
* use the nominal perf value
14091409
*/
1410-
if (CPC_SUPPORTED(reference_reg)) {
1410+
if (CPC_SUPPORTED(reference_reg))
14111411
cpc_read(cpunum, reference_reg, &ref);
1412-
perf_caps->reference_perf = ref;
1413-
} else {
1414-
perf_caps->reference_perf = nom;
1415-
}
1412+
else
1413+
ref = nom;
1414+
perf_caps->reference_perf = ref;
14161415

14171416
if (guaranteed_reg->type != ACPI_TYPE_BUFFER ||
14181417
IS_NULL_REG(&guaranteed_reg->cpc_entry.reg)) {

0 commit comments

Comments
 (0)