compr_zlib.c (94bd217e2d683719ab21a4ac117d8a1b91cbedc9) compr_zlib.c (045ead345b53c6186303f1413f90154f3137f457)
1/*
2 * JFFS2 -- Journalling Flash File System, Version 2.
3 *
4 * Copyright © 2001-2007 Red Hat, Inc.
5 * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org>
6 *
7 * Created by David Woodhouse <dwmw2@infradead.org>
8 *

--- 28 unchanged lines hidden (view full) ---

37#include <linux/vmalloc.h>
38#include <linux/init.h>
39#include <linux/mutex.h>
40
41static int __init alloc_workspaces(void)
42{
43 def_strm.workspace = vmalloc(zlib_deflate_workspacesize(MAX_WBITS,
44 MAX_MEM_LEVEL));
1/*
2 * JFFS2 -- Journalling Flash File System, Version 2.
3 *
4 * Copyright © 2001-2007 Red Hat, Inc.
5 * Copyright © 2004-2010 David Woodhouse <dwmw2@infradead.org>
6 *
7 * Created by David Woodhouse <dwmw2@infradead.org>
8 *

--- 28 unchanged lines hidden (view full) ---

37#include <linux/vmalloc.h>
38#include <linux/init.h>
39#include <linux/mutex.h>
40
41static int __init alloc_workspaces(void)
42{
43 def_strm.workspace = vmalloc(zlib_deflate_workspacesize(MAX_WBITS,
44 MAX_MEM_LEVEL));
45 if (!def_strm.workspace) {
46 printk(KERN_WARNING "Failed to allocate %d bytes for deflate workspace\n", zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL));
45 if (!def_strm.workspace)
47 return -ENOMEM;
46 return -ENOMEM;
48 }
47
49 D1(printk(KERN_DEBUG "Allocated %d bytes for deflate workspace\n", zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL)));
50 inf_strm.workspace = vmalloc(zlib_inflate_workspacesize());
51 if (!inf_strm.workspace) {
48 D1(printk(KERN_DEBUG "Allocated %d bytes for deflate workspace\n", zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL)));
49 inf_strm.workspace = vmalloc(zlib_inflate_workspacesize());
50 if (!inf_strm.workspace) {
52 printk(KERN_WARNING "Failed to allocate %d bytes for inflate workspace\n", zlib_inflate_workspacesize());
53 vfree(def_strm.workspace);
54 return -ENOMEM;
55 }
56 D1(printk(KERN_DEBUG "Allocated %d bytes for inflate workspace\n", zlib_inflate_workspacesize()));
57 return 0;
58}
59
60static void free_workspaces(void)

--- 158 unchanged lines hidden ---
51 vfree(def_strm.workspace);
52 return -ENOMEM;
53 }
54 D1(printk(KERN_DEBUG "Allocated %d bytes for inflate workspace\n", zlib_inflate_workspacesize()));
55 return 0;
56}
57
58static void free_workspaces(void)

--- 158 unchanged lines hidden ---