summaryrefslogtreecommitdiff
path: root/host/lib/flashrom_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'host/lib/flashrom_drv.c')
-rw-r--r--host/lib/flashrom_drv.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/host/lib/flashrom_drv.c b/host/lib/flashrom_drv.c
index a9889cc9..880a0fc9 100644
--- a/host/lib/flashrom_drv.c
+++ b/host/lib/flashrom_drv.c
@@ -80,19 +80,12 @@ static int flashrom_read_image_impl(struct firmware_image *image,
flashrom_flag_set(flashctx, FLASHROM_FLAG_SKIP_UNREADABLE_REGIONS, true);
if (region) {
- r = flashrom_layout_read_fmap_from_buffer(
- &layout, flashctx, (const uint8_t *)image->data,
- image->size);
+ r = flashrom_layout_read_fmap_from_rom(
+ &layout, flashctx, 0, len);
if (r > 0) {
- WARN("could not read fmap from image, r=%d, "
- "falling back to read from rom\n", r);
- r = flashrom_layout_read_fmap_from_rom(
- &layout, flashctx, 0, len);
- if (r > 0) {
- ERROR("could not read fmap from rom, r=%d\n", r);
- r = -1;
- goto err_cleanup;
- }
+ ERROR("could not read fmap from rom, r=%d\n", r);
+ r = -1;
+ goto err_cleanup;
}
// empty region causes seg fault in API.
r |= flashrom_layout_include_region(layout, region);