[coreboot-gerrit] New patch to review for coreboot: 93a0eec amd/amdfam10: Fix Coverity warnings

Timothy Pearson (tpearson@raptorengineeringinc.com) gerrit at coreboot.org
Sat Feb 7 19:54:07 CET 2015


Timothy Pearson (tpearson at raptorengineeringinc.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8390

-gerrit

commit 93a0eec0ef4a7446d6bff892d2105f2e22309dcc
Author: Timothy Pearson <tpearson at raptorengineeringinc.com>
Date:   Sat Feb 7 12:50:04 2015 -0600

    amd/amdfam10: Fix Coverity warnings
    
    Operation of coreboot is unaffected by this patch.
    
    Change-Id: I6fc876c437333d5605bdfc9dd9ed2d20a9d5f5df
    Found-by: Coverity Scan
    Signed-off-by: Timothy Pearson <tpearson at raptorengineeringinc.com>
---
 src/cpu/amd/model_10xxx/powernow_acpi.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/cpu/amd/model_10xxx/powernow_acpi.c b/src/cpu/amd/model_10xxx/powernow_acpi.c
index d08f9f9..f12d483 100644
--- a/src/cpu/amd/model_10xxx/powernow_acpi.c
+++ b/src/cpu/amd/model_10xxx/powernow_acpi.c
@@ -76,11 +76,11 @@ static void pstates_algorithm(u32 pcontrol_blk, u8 plen, u8 onlyBSP)
 	u32 *v;
 	struct cpuid_result cpuid1;
 
-	u16 Pstate_feq[10];
-	u32 Pstate_power[10];
-	u32 Pstate_latency[10];
-	u32 Pstate_control[10];
-	u32 Pstate_status[10];
+	u16 Pstate_feq[10] = {0};
+	u32 Pstate_power[10] = {0};
+	u32 Pstate_latency[10] = {0};
+	u32 Pstate_control[10] = {0};
+	u32 Pstate_status[10] = {0};
 	u8 Pstate_num;
 	u8 cmp_cap;
 	u8 index;
@@ -204,6 +204,9 @@ static void pstates_algorithm(u32 pcontrol_blk, u8 plen, u8 onlyBSP)
 			case 0x3:
 				expanded_cpuidv = 1000;
 				break;
+			default:
+				/* Should never reach this statement, but avoid a crash if we do */
+				expanded_cpuidv = 1;
 		}
 		core_power = (core_voltage * cpuidd) / (expanded_cpuidv * 10);
 



More information about the coreboot-gerrit mailing list