From b1ea53d846b865d5fa1332fb2e31d0f2865a7fc0 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Fri, 8 Nov 2019 09:51:15 -0700 Subject: region: add rdev_chain_full() Instead of open coding an offset of 0 and querying the size of a region device provide a rdev_chain_full() helper function that does that for the caller. For the existing users that match this pattern convert them to using rdev_chain_full(). Change-Id: Ie316790a8a5b16a7f7e22f86f58bd2e633c19450 Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/c/coreboot/+/36683 Reviewed-by: Julius Werner Tested-by: build bot (Jenkins) --- src/lib/fmap.c | 3 +-- src/lib/region_file.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/fmap.c b/src/lib/fmap.c index a427102210..f3ff071766 100644 --- a/src/lib/fmap.c +++ b/src/lib/fmap.c @@ -49,8 +49,7 @@ static int find_fmap_directory(struct region_device *fmrd) cache = car_get_var_ptr(&fmap_cache); if (region_device_sz(&cache->rdev)) - return rdev_chain(fmrd, &cache->rdev, 0, - region_device_sz(&cache->rdev)); + return rdev_chain_full(fmrd, &cache->rdev); } boot_device_init(); diff --git a/src/lib/region_file.c b/src/lib/region_file.c index e42c2afd1e..05d619c9a4 100644 --- a/src/lib/region_file.c +++ b/src/lib/region_file.c @@ -208,7 +208,7 @@ int region_file_init(struct region_file *f, const struct region_device *p) f->slot = RF_FATAL; /* Keep parent around for accessing data later. */ - if (rdev_chain(&f->rdev, p, 0, region_device_sz(p))) + if (rdev_chain_full(&f->rdev, p)) return -1; if (rdev_readat(p, &mb, 0, sizeof(mb)) < 0) { -- cgit v1.2.3