summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/drivers/intel/fsp2_0/util.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/drivers/intel/fsp2_0/util.c b/src/drivers/intel/fsp2_0/util.c
index 4fd4f689a3..da8aa9c271 100644
--- a/src/drivers/intel/fsp2_0/util.c
+++ b/src/drivers/intel/fsp2_0/util.c
@@ -95,11 +95,20 @@ enum cb_err fsp_load_binary(struct fsp_header *hdr,
/* Map just enough of the file to be able to parse the header. */
membase = rdev_mmap(&file_data, FSP_HDR_OFFSET, FSP_HDR_LEN);
+
+ if (membase == NULL) {
+ printk(BIOS_ERR, "Could not mmap() '%s' FSP header.\n", name);
+ return CB_ERR;
+ }
+
if (fsp_identify(hdr, membase) != CB_SUCCESS) {
+ rdev_munmap(&file_data, membase);
printk(BIOS_ERR, "%s did not have a valid FSP header\n", name);
return CB_ERR;
}
+ rdev_munmap(&file_data, membase);
+
fsp_print_header_info(hdr);
/* Check if size specified in the header matches the cbfs file size */