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 <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/36683
Reviewed-by: Julius Werner <jwerner@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Aaron Durbin
2019-11-08 09:51:15 -07:00
committed by Patrick Georgi
parent f0564a9c44
commit b1ea53d846
4 changed files with 11 additions and 7 deletions

View File

@ -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) {