diff options
-rw-r--r-- | util/cbfstool/cbfs_image.c | 7 | ||||
-rw-r--r-- | util/cbfstool/cbfs_image.h | 3 | ||||
-rw-r--r-- | util/cbfstool/cbfstool.c | 5 | ||||
-rw-r--r-- | util/cbfstool/ifittool.c | 2 |
4 files changed, 10 insertions, 7 deletions
diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index 5f30877df2..97ad995545 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -346,9 +346,8 @@ int cbfs_image_from_buffer(struct cbfs_image *out, struct buffer *in, out->has_header = true; cbfs_fix_legacy_size(out, header_loc); return 0; - } else if (offset != ~0u) { + } else if (offset != HEADER_OFFSET_UNKNOWN) { ERROR("The -H switch is only valid on legacy images having CBFS master headers.\n"); - return 1; } ERROR("Selected image region is not a valid CBFS.\n"); return 1; @@ -415,7 +414,7 @@ int cbfs_expand_to_region(struct buffer *region) struct cbfs_image image; memset(&image, 0, sizeof(image)); - if (cbfs_image_from_buffer(&image, region, 0)) { + if (cbfs_image_from_buffer(&image, region, HEADER_OFFSET_UNKNOWN)) { ERROR("reading CBFS failed!\n"); return 1; } @@ -454,7 +453,7 @@ int cbfs_truncate_space(struct buffer *region, uint32_t *size) struct cbfs_image image; memset(&image, 0, sizeof(image)); - if (cbfs_image_from_buffer(&image, region, 0)) { + if (cbfs_image_from_buffer(&image, region, HEADER_OFFSET_UNKNOWN)) { ERROR("reading CBFS failed!\n"); return 1; } diff --git a/util/cbfstool/cbfs_image.h b/util/cbfstool/cbfs_image.h index 664d1461d7..85ba023e1b 100644 --- a/util/cbfstool/cbfs_image.h +++ b/util/cbfstool/cbfs_image.h @@ -6,6 +6,9 @@ #include "common.h" #include "cbfs.h" + +#define HEADER_OFFSET_UNKNOWN (~0u) + /* CBFS image processing */ struct cbfs_image { diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 87b5d00f19..c2191d27a5 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -113,7 +113,7 @@ static struct param { .arch = CBFS_ARCHITECTURE_UNKNOWN, .compression = CBFS_COMPRESS_NONE, .hash = VB2_HASH_INVALID, - .headeroffset = ~0, + .headeroffset = HEADER_OFFSET_UNKNOWN, .region_name = SECTION_NAME_PRIMARY_CBFS, .u64val = -1, }; @@ -1738,7 +1738,8 @@ static int cbfs_truncate(void) uint32_t size; int result = cbfs_truncate_space(param.image_region, &size); - printf("0x%x\n", size); + if (!result) + printf("0x%x\n", size); return result; } diff --git a/util/cbfstool/ifittool.c b/util/cbfstool/ifittool.c index 88a973c5af..9ea3149fcc 100644 --- a/util/cbfstool/ifittool.c +++ b/util/cbfstool/ifittool.c @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) uint32_t addr = 0; size_t topswap_size = 0; enum fit_type fit_type = 0; - uint32_t headeroffset = ~0u; + uint32_t headeroffset = HEADER_OFFSET_UNKNOWN; verbose = 0; |