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>
This commit is contained in:
Eric Lai 2020-04-21 15:50:04 +08:00 committed by Tim Wawrzynczak
parent 6ba3a0758f
commit 26afd648a1
1 changed files with 6 additions and 1 deletions

View File

@ -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]);
}
}