drivers/intel/fsp1_1: Exit cleanly if FSP not found
Instead of dereferencing a null pointer, print a nice message and exit cleanly if the FSP isn't found in the CBFS. Change-Id: I761e7febc7cec5bd2ef3af214bc51777ee5c313d Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Found-by: Coverity CID 1401467, 1401717 Reviewed-on: https://review.coreboot.org/c/coreboot/+/33049 Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
7da638c20e
commit
f7f90f7c3f
|
@ -160,17 +160,14 @@ void mainboard_romstage_entry(unsigned long bist)
|
||||||
{
|
{
|
||||||
/* Need to locate the current FSP_INFO_HEADER. The cache-as-ram
|
/* Need to locate the current FSP_INFO_HEADER. The cache-as-ram
|
||||||
* is still enabled. We can directly access work buffer here. */
|
* is still enabled. We can directly access work buffer here. */
|
||||||
FSP_INFO_HEADER *fih;
|
|
||||||
struct prog fsp = PROG_INIT(PROG_REFCODE, "fsp.bin");
|
struct prog fsp = PROG_INIT(PROG_REFCODE, "fsp.bin");
|
||||||
|
|
||||||
if (prog_locate(&fsp)) {
|
if (prog_locate(&fsp))
|
||||||
fih = NULL;
|
die_with_post_code(POST_INVALID_CBFS, "Unable to locate fsp.bin");
|
||||||
printk(BIOS_ERR, "Unable to locate %s\n", prog_name(&fsp));
|
|
||||||
} else {
|
|
||||||
/* This leaks a mapping which this code assumes is benign as
|
/* This leaks a mapping which this code assumes is benign as
|
||||||
* the flash is memory mapped CPU's address space. */
|
* the flash is memory mapped CPU's address space. */
|
||||||
fih = find_fsp((uintptr_t)rdev_mmap_full(prog_rdev(&fsp)));
|
FSP_INFO_HEADER *fih = find_fsp((uintptr_t)rdev_mmap_full(prog_rdev(&fsp)));
|
||||||
}
|
|
||||||
|
|
||||||
cache_as_ram_stage_main(fih);
|
cache_as_ram_stage_main(fih);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue