mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
zram: clean up zram_meta_alloc()
A trivial cleanup of zram_meta_alloc() error handling. Signed-off-by: Sergey Senozhatsky <[email protected]> Acked-by: Minchan Kim <[email protected]> Cc: Nitin Gupta <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
ff59909a07
commit
b817995832
1 changed files with 6 additions and 8 deletions
|
|
@ -318,31 +318,29 @@ static struct zram_meta *zram_meta_alloc(u64 disksize)
|
|||
{
|
||||
size_t num_pages;
|
||||
struct zram_meta *meta = kmalloc(sizeof(*meta), GFP_KERNEL);
|
||||
|
||||
if (!meta)
|
||||
goto out;
|
||||
return NULL;
|
||||
|
||||
num_pages = disksize >> PAGE_SHIFT;
|
||||
meta->table = vzalloc(num_pages * sizeof(*meta->table));
|
||||
if (!meta->table) {
|
||||
pr_err("Error allocating zram address table\n");
|
||||
goto free_meta;
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
meta->mem_pool = zs_create_pool(GFP_NOIO | __GFP_HIGHMEM);
|
||||
if (!meta->mem_pool) {
|
||||
pr_err("Error creating memory pool\n");
|
||||
goto free_table;
|
||||
goto out_error;
|
||||
}
|
||||
|
||||
return meta;
|
||||
|
||||
free_table:
|
||||
out_error:
|
||||
vfree(meta->table);
|
||||
free_meta:
|
||||
kfree(meta);
|
||||
meta = NULL;
|
||||
out:
|
||||
return meta;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void update_position(u32 *index, int *offset, struct bio_vec *bvec)
|
||||
|
|
|
|||
Loading…
Reference in a new issue