diff --git a/util/cbfstool/cbfs_image.c b/util/cbfstool/cbfs_image.c index e5334831fd..4b6bda929a 100644 --- a/util/cbfstool/cbfs_image.c +++ b/util/cbfstool/cbfs_image.c @@ -925,14 +925,6 @@ static int cbfs_payload_decompress(struct cbfs_payload_segment *segments, struct buffer tbuff; size_t decomp_size; - /* The payload uses an unknown compression algorithm. */ - decompress = decompression_function(segments[i].compression); - if (decompress == NULL) { - ERROR("Unknown decompression algorithm: %u", - segments[i].compression); - return -1; - } - /* Segments BSS and ENTRY do not have binary data. */ if (segments[i].type == PAYLOAD_SEGMENT_BSS || segments[i].type == PAYLOAD_SEGMENT_ENTRY) { @@ -947,6 +939,14 @@ static int cbfs_payload_decompress(struct cbfs_payload_segment *segments, continue; } + /* The payload uses an unknown compression algorithm. */ + decompress = decompression_function(segments[i].compression); + if (decompress == NULL) { + ERROR("Unknown decompression algorithm: %u\n", + segments[i].compression); + return -1; + } + if (buffer_create(&tbuff, segments[i].mem_len, "segment")) { buffer_delete(&new_buffer); return -1;