From aab66b1dc7908366f35ed58b774bb2dbe214278c Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Sun, 22 Feb 2015 16:27:56 +0100 Subject: [PATCH] AMD Fam10h: sanity check some CPU data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a certain register returns crap values, we determine core_power using an uninitialized variable. That doesn't sound healthy. Change-Id: I1e890b78bfcc3bf0255a3d4f6561a783134b1719 Signed-off-by: Patrick Georgi Found-by: Coverity Scan Reviewed-on: http://review.coreboot.org/8508 Reviewed-by: Timothy Pearson Tested-by: build bot (Jenkins) Reviewed-by: Kyösti Mälkki --- src/cpu/amd/model_10xxx/powernow_acpi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cpu/amd/model_10xxx/powernow_acpi.c b/src/cpu/amd/model_10xxx/powernow_acpi.c index feb8f01f60..09726a0cda 100644 --- a/src/cpu/amd/model_10xxx/powernow_acpi.c +++ b/src/cpu/amd/model_10xxx/powernow_acpi.c @@ -223,6 +223,11 @@ static void pstates_algorithm(u32 pcontrol_blk, u8 plen, u8 onlyBSP) case 0x3: expanded_cpuidv = 1000; break; + default: + printk(BIOS_ERR, "%s:%s:%d: Invalid cpuidv, " + "not generating pstate tables.\n", + __FILE__, __func__, __LINE__); + return; } core_power = (core_voltage * cpuidd) / (expanded_cpuidv * 10);