Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 118474
b: refs/heads/master
c: dc8a084
h: refs/heads/master
v: v3
  • Loading branch information
Geert Uytterhoeven authored and David Woodhouse committed Nov 5, 2008
1 parent 657d36e commit 598488e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 467622ef2acb01986eab37ef96c3632b3ea35999
refs/heads/master: dc8a0843a435b2c0891e7eaea64faaf1ebec9b11
15 changes: 9 additions & 6 deletions trunk/fs/jffs2/compr_lzo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 598488e

Please sign in to comment.