From 26afd648a1969df55a5786a2c877eec5144400ae Mon Sep 17 00:00:00 2001 From: Eric Lai Date: Tue, 21 Apr 2020 15:50:04 +0800 Subject: soc/intel/tigerlake: Check SPD is not NULL before print Check SPD is not NULL before print. This can prevent the system from hanging up. BUG=b:154445630 TEST=Check NULL SPD is not print. Signed-off-by: Eric Lai Change-Id: Iccd9fce99eda7ae2b8fb1b4f3c2e635c2a428f04 Reviewed-on: https://review.coreboot.org/c/coreboot/+/40560 Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) --- src/soc/intel/tigerlake/meminit.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/soc/intel') diff --git a/src/soc/intel/tigerlake/meminit.c b/src/soc/intel/tigerlake/meminit.c index ebadcffe84..231e261968 100644 --- a/src/soc/intel/tigerlake/meminit.c +++ b/src/soc/intel/tigerlake/meminit.c @@ -315,8 +315,13 @@ static void read_sodimm_spd(const struct spd_info *info, struct spd_block *blk) get_spd_smbus(blk); + /* + * SPD gets printed only if: + * a) mainboard provides a non-zero SMBus address and + * b) SPD is successfully read using the SMBus address + */ for (i = 0; i < ARRAY_SIZE(blk->addr_map); i++) { - if (blk->addr_map[i]) + if (blk->spd_array[i] != NULL) print_spd_info((uint8_t *)blk->spd_array[i]); } } -- cgit v1.2.3