summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Lai <ericr_lai@compal.corp-partner.google.com>2020-04-21 15:50:04 +0800
committerTim Wawrzynczak <twawrzynczak@chromium.org>2020-04-29 21:26:01 +0000
commit26afd648a1969df55a5786a2c877eec5144400ae (patch)
treea9180498d87f8827ff84324e40fb0ddce5213461
parent6ba3a0758f7162834378e5845ea3a65fe327012c (diff)
downloadcoreboot-26afd648a1969df55a5786a2c877eec5144400ae.tar.xz
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>
-rw-r--r--src/soc/intel/tigerlake/meminit.c7
1 files changed, 6 insertions, 1 deletions
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]);
}
}