Yu-Ping Wu has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/77193?usp=email )
Change subject: libpayload/cbfs: Fill size_out even if cbfs_map() fails ......................................................................
libpayload/cbfs: Fill size_out even if cbfs_map() fails
When cbfs_map()/cbfs_ro_map() fails, the caller may still want to know the decompressed size of the CBFS file. Move the assignment earlier in the flow. Note that coreboot's cbfs_map() is already doing the same.
BUG=none TEST=emerge-geralt libpayload BRANCH=none
Change-Id: I82c6b7e69c95bf597fa3c7d37dd11252893c01af Signed-off-by: Yu-Ping Wu yupingso@chromium.org --- M payloads/libpayload/libcbfs/cbfs.c 1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/77193/1
diff --git a/payloads/libpayload/libcbfs/cbfs.c b/payloads/libpayload/libcbfs/cbfs.c index a158ba8..e37e8c9 100644 --- a/payloads/libpayload/libcbfs/cbfs.c +++ b/payloads/libpayload/libcbfs/cbfs.c @@ -168,6 +168,8 @@ return NULL; } } else { + if (size_inout) + *size_inout = out_size; buf = malloc(out_size); if (!buf) { ERROR("'%s' allocation failure\n", mdata->h.filename); @@ -183,8 +185,6 @@ free(buf); return NULL; } - if (size_inout) - *size_inout = out_size;
return buf; }