summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-12-02 13:17:40 -0700
committerTom Rini <trini@ti.com>2015-01-14 11:35:44 -0500
commit670c0179ec1f48e0113ec082143a9acdd2f7d6aa (patch)
tree1765d0a1ed5421714774afce2fe45ae58717719c
parent9c55c54fb474ba5bc005e489639aa06c3c00d012 (diff)
downloadu-boot-imx-670c0179ec1f48e0113ec082143a9acdd2f7d6aa.zip
u-boot-imx-670c0179ec1f48e0113ec082143a9acdd2f7d6aa.tar.gz
u-boot-imx-670c0179ec1f48e0113ec082143a9acdd2f7d6aa.tar.bz2
lzo: Update dst_len even on error
This allows the caller to easily detect how much of the destination buffer has been used. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--lib/lzo/lzo1x_decompress.c4
1 files changed, 3 insertions, 1 deletions
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;