drivers/intel/fsp2_0: Add NULL check while locating hob list ptr
Assert incase unable to locate hob list pointer due to cbmem is not available. Change-Id: I17f54b07ab149ae06d09226ed9063189d829efe2 Signed-off-by: Subrata Banik <subrata.banik@intel.com> Reviewed-on: https://review.coreboot.org/20749 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
815417145e
commit
097bd95837
|
@ -105,10 +105,14 @@ static void *fsp_hob_list_ptr CAR_GLOBAL;
|
||||||
static void save_hob_list(int is_recovery)
|
static void save_hob_list(int is_recovery)
|
||||||
{
|
{
|
||||||
uint32_t *cbmem_loc;
|
uint32_t *cbmem_loc;
|
||||||
|
const void *hob_list;
|
||||||
cbmem_loc = cbmem_add(CBMEM_ID_FSP_RUNTIME, sizeof(*cbmem_loc));
|
cbmem_loc = cbmem_add(CBMEM_ID_FSP_RUNTIME, sizeof(*cbmem_loc));
|
||||||
if (cbmem_loc == NULL)
|
if (cbmem_loc == NULL)
|
||||||
die("Error: Could not add cbmem area for hob list.\n");
|
die("Error: Could not add cbmem area for hob list.\n");
|
||||||
*cbmem_loc = (uintptr_t)fsp_get_hob_list();
|
hob_list = fsp_get_hob_list();
|
||||||
|
if (!hob_list)
|
||||||
|
die("Error: Could not locate hob list pointer.\n");
|
||||||
|
*cbmem_loc = (uintptr_t)hob_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
ROMSTAGE_CBMEM_INIT_HOOK(save_hob_list);
|
ROMSTAGE_CBMEM_INIT_HOOK(save_hob_list);
|
||||||
|
@ -167,6 +171,9 @@ int fsp_find_range_hob(struct range_entry *re, const uint8_t guid[16])
|
||||||
const struct hob_resource *fsp_mem;
|
const struct hob_resource *fsp_mem;
|
||||||
const void *hob_list = fsp_get_hob_list();
|
const void *hob_list = fsp_get_hob_list();
|
||||||
|
|
||||||
|
if (!hob_list)
|
||||||
|
return -1;
|
||||||
|
|
||||||
range_entry_init(re, 0, 0, 0);
|
range_entry_init(re, 0, 0, 0);
|
||||||
|
|
||||||
fsp_mem = find_resource_hob_by_guid(hob_list, guid);
|
fsp_mem = find_resource_hob_by_guid(hob_list, guid);
|
||||||
|
|
Loading…
Reference in New Issue