Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 268279
b: refs/heads/master
c: 5a18c53
h: refs/heads/master
i:
  268277: 168e8ff
  268275: 67a0836
  268271: 2e0dc19
v: v3
  • Loading branch information
Jerome Marchand authored and Greg Kroah-Hartman committed Sep 6, 2011
1 parent 4a72534 commit edd8ce7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 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: 0900beae178a84e653d9088979cf3014babc097e
refs/heads/master: 5a18c53147205797da3dbc5a7c2678d16709d2dc
11 changes: 6 additions & 5 deletions trunk/drivers/staging/zram/zram_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,24 +651,22 @@ int zram_init_device(struct zram *zram)
if (!zram->compress_workmem) {
pr_err("Error allocating compressor working memory!\n");
ret = -ENOMEM;
goto fail;
goto fail_no_table;
}

zram->compress_buffer = (void *)__get_free_pages(__GFP_ZERO, 1);
if (!zram->compress_buffer) {
pr_err("Error allocating compressor buffer space\n");
ret = -ENOMEM;
goto fail;
goto fail_no_table;
}

num_pages = zram->disksize >> PAGE_SHIFT;
zram->table = vzalloc(num_pages * sizeof(*zram->table));
if (!zram->table) {
pr_err("Error allocating zram address table\n");
/* To prevent accessing table entries during cleanup */
zram->disksize = 0;
ret = -ENOMEM;
goto fail;
goto fail_no_table;
}

set_capacity(zram->disk, zram->disksize >> SECTOR_SHIFT);
Expand All @@ -689,6 +687,9 @@ int zram_init_device(struct zram *zram)
pr_debug("Initialization done!\n");
return 0;

fail_no_table:
/* To prevent accessing table entries during cleanup */
zram->disksize = 0;
fail:
__zram_reset_device(zram);
up_write(&zram->init_lock);
Expand Down

0 comments on commit edd8ce7

Please sign in to comment.