vc/cavium/bdk/libdram: Print unknown voltages

volt_str is used to print information about the RAM configuration
in report_common_dimm(), so let's print out "unknown voltage" if the
voltage isn't recognized rather than a garbage value.

Change-Id: I8e85917fd682e166172fbf10597bde4a8a11dfc7
Signed-off-by: Jacob Garber <jgarber1@ualberta.ca>
Found-by: Coverity CID 1393958, 1393982
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34576
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
This commit is contained in:
Jacob Garber 2019-07-25 15:45:53 -06:00 committed by Patrick Georgi
parent 336420348e
commit 321daa86ef
1 changed files with 2 additions and 2 deletions

View File

@ -424,7 +424,7 @@ void report_ddr3_dimm(bdk_node_t node, const dimm_config_t *dimm_config,
int dram_width, int dimm_size_mb) int dram_width, int dimm_size_mb)
{ {
int spd_voltage; int spd_voltage;
const char *volt_str; const char *volt_str = "unknown voltage";
spd_voltage = read_spd(node, dimm_config, DDR3_SPD_NOMINAL_VOLTAGE); spd_voltage = read_spd(node, dimm_config, DDR3_SPD_NOMINAL_VOLTAGE);
if ((spd_voltage == 0) || (spd_voltage & 3)) if ((spd_voltage == 0) || (spd_voltage & 3))
@ -464,7 +464,7 @@ void report_ddr4_dimm(bdk_node_t node, const dimm_config_t *dimm_config,
int dram_width, int dimm_size_mb) int dram_width, int dimm_size_mb)
{ {
int spd_voltage; int spd_voltage;
const char *volt_str; const char *volt_str = "unknown voltage";
spd_voltage = read_spd(node, dimm_config, DDR4_SPD_MODULE_NOMINAL_VOLTAGE); spd_voltage = read_spd(node, dimm_config, DDR4_SPD_MODULE_NOMINAL_VOLTAGE);
if ((spd_voltage == 0x01) || (spd_voltage & 0x02)) if ((spd_voltage == 0x01) || (spd_voltage & 0x02))