[U-Boot] [PATCH v2 12/12] lzo: Update dst_len even on error

Simon Glass sjg at chromium.org
Tue Dec 2 21:17:40 CET 2014


This allows the caller to easily detect how much of the destination buffer
has been used.

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

Changes in v2: None

 lib/lzo/lzo1x_decompress.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/lzo/lzo1x_decompress.c b/lib/lzo/lzo1x_decompress.c
index 35f3793..ebdf10b 100644
--- a/lib/lzo/lzo1x_decompress.c
+++ b/lib/lzo/lzo1x_decompress.c
@@ -102,8 +102,10 @@ int lzop_decompress(const unsigned char *src, size_t src_len,
 		tmp = dlen;
 		r = lzo1x_decompress_safe((u8 *) src, slen, dst, &tmp);
 
-		if (r != LZO_E_OK)
+		if (r != LZO_E_OK) {
+			*dst_len = dst - start;
 			return r;
+		}
 
 		if (dlen != tmp)
 			return LZO_E_ERROR;
-- 
2.2.0.rc0.207.ga3a616c



More information about the U-Boot mailing list