[PATCH v3 07/15] image: Update zstd to avoid reporting error twice

Simon Glass sjg at chromium.org
Sun Aug 1 23:00:24 CEST 2021


The zstd implementation prints the error in image_decomp() which is
incorrect and does not match other algorithms. Drop this and let the
caller report the error.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

(no changes since v1)

 common/image.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/common/image.c b/common/image.c
index 6c38211efce..bd71bf7ec29 100644
--- a/common/image.c
+++ b/common/image.c
@@ -532,12 +532,10 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		abuf_init_set(&in, image_buf, image_len);
 		abuf_init_set(&in, load_buf, unc_len);
 		ret = zstd_decompress(&in, &out);
-		if (ret < 0) {
-			printf("ZSTD decompression failed\n");
-			return ret;
+		if (ret >= 0) {
+			image_len = ret;
+			ret = 0;
 		}
-
-		image_len = ret;
 		break;
 	}
 #endif /* CONFIG_ZSTD */
-- 
2.32.0.554.ge1b32706d8-goog



More information about the U-Boot mailing list