drivers/intel/fsp2_0: don't leak resources
rdev_mmap() was not followed by rdev_munmap(), thus leaking resources. Fix the leak. Change-Id: Ibdd30d6b64616038013b4bb748f2ad4a98db5472 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/13958 Reviewed-by: Furquan Shaikh <furquan@google.com> Tested-by: build bot (Jenkins) Reviewed-by: Andrey Petrov <andrey.petrov@intel.com>
This commit is contained in:
parent
ac1c9ece23
commit
40672becaa
|
@ -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. */
|
/* Map just enough of the file to be able to parse the header. */
|
||||||
membase = rdev_mmap(&file_data, FSP_HDR_OFFSET, FSP_HDR_LEN);
|
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) {
|
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);
|
printk(BIOS_ERR, "%s did not have a valid FSP header\n", name);
|
||||||
return CB_ERR;
|
return CB_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rdev_munmap(&file_data, membase);
|
||||||
|
|
||||||
fsp_print_header_info(hdr);
|
fsp_print_header_info(hdr);
|
||||||
|
|
||||||
/* Check if size specified in the header matches the cbfs file size */
|
/* Check if size specified in the header matches the cbfs file size */
|
||||||
|
|
Loading…
Reference in New Issue