lib/cbfs.c: Fix return value of failure to measure

Returning an error on a failure to measure makes the system not
bootable.

Change-Id: Ifd20e543d3b30de045c0656eccdcc494c2fb10ce
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/51099
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Christian Walter <christian.walter@9elements.com>
This commit is contained in:
Arthur Heymans 2021-02-26 14:22:47 +01:00 committed by Patrick Georgi
parent e8e5107b49
commit 27545df163
1 changed files with 4 additions and 3 deletions

View File

@ -69,8 +69,9 @@ cb_err_t cbfs_boot_lookup(const char *name, bool force_ro,
if (rdev_chain(rdev, &cbd->rdev, data_offset, be32toh(mdata->h.len))) if (rdev_chain(rdev, &cbd->rdev, data_offset, be32toh(mdata->h.len)))
return CB_ERR; return CB_ERR;
if (tspi_measure_cbfs_hook(rdev, name, be32toh(mdata->h.type))) if (tspi_measure_cbfs_hook(rdev, name, be32toh(mdata->h.type))) {
return CB_ERR; printk(BIOS_ERR, "CBFS ERROR: error when measuring '%s'\n", name);
}
return CB_SUCCESS; return CB_SUCCESS;
} }
@ -144,7 +145,7 @@ int cbfs_locate_file_in_region(struct cbfsf *fh, const char *region_name,
ret = cbfs_locate(fh, &rdev, name, type); ret = cbfs_locate(fh, &rdev, name, type);
if (!ret) if (!ret)
if (tspi_measure_cbfs_hook(&rdev, name, *type)) if (tspi_measure_cbfs_hook(&rdev, name, *type))
return -1; LOG("error measuring %s in region %s\n", name, region_name);
return ret; return ret;
} }