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 <ericr_lai@compal.corp-partner.google.com>
Change-Id: Iccd9fce99eda7ae2b8fb1b4f3c2e635c2a428f04
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40560
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/src/soc/intel/tigerlake/meminit.c b/src/soc/intel/tigerlake/meminit.c
index ebadcff..231e261 100644
--- a/src/soc/intel/tigerlake/meminit.c
+++ b/src/soc/intel/tigerlake/meminit.c
@@ -315,8 +315,13 @@
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]);
}
}