aboutsummaryrefslogtreecommitdiff
path: root/fs/jffs2/compr_lzo.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-12-16 20:57:41 +0100
committerIngo Molnar <mingo@elte.hu>2008-12-16 20:57:41 +0100
commitdd7a5230cd651bfb119d222561c4032f30dd5659 (patch)
tree85628ef75d1f512f43df6f760980b6cce6cf40c7 /fs/jffs2/compr_lzo.c
parent050dc6944b9ca2186f4729ab44e0da3743933941 (diff)
parent8b1fae4e4200388b64dd88065639413cb3f1051c (diff)
Merge commit 'v2.6.28-rc8' into x86/cpufeature
Diffstat (limited to 'fs/jffs2/compr_lzo.c')
-rw-r--r--fs/jffs2/compr_lzo.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/jffs2/compr_lzo.c b/fs/jffs2/compr_lzo.c
index 47b045797e4..90cb60d0978 100644
--- a/fs/jffs2/compr_lzo.c
+++ b/fs/jffs2/compr_lzo.c
@@ -19,7 +19,7 @@
static void *lzo_mem;
static void *lzo_compress_buf;
-static DEFINE_MUTEX(deflate_mutex);
+static DEFINE_MUTEX(deflate_mutex); /* for lzo_mem and lzo_compress_buf */
static void free_workspace(void)
{
@@ -49,18 +49,21 @@ static int jffs2_lzo_compress(unsigned char *data_in, unsigned char *cpage_out,
mutex_lock(&deflate_mutex);
ret = lzo1x_1_compress(data_in, *sourcelen, lzo_compress_buf, &compress_size, lzo_mem);
- mutex_unlock(&deflate_mutex);
-
if (ret != LZO_E_OK)
- return -1;
+ goto fail;
if (compress_size > *dstlen)
- return -1;
+ goto fail;
memcpy(cpage_out, lzo_compress_buf, compress_size);
- *dstlen = compress_size;
+ mutex_unlock(&deflate_mutex);
+ *dstlen = compress_size;
return 0;
+
+ fail:
+ mutex_unlock(&deflate_mutex);
+ return -1;
}
static int jffs2_lzo_decompress(unsigned char *data_in, unsigned char *cpage_out,