diff options
author | Sergey Senozhatsky <sergey.senozhatsky@gmail.com> | 2015-02-12 18:00:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-12 21:54:11 -0500 |
commit | b8179958327a1f513efca095ba782a1986c7c4fb (patch) | |
tree | 134afec269a887efefcc834960b273018a8ccf76 /drivers/block | |
parent | ff59909a077b3c51c168cb658601c6b63136a347 (diff) |
zram: clean up zram_meta_alloc()
A trivial cleanup of zram_meta_alloc() error handling.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/zram/zram_drv.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index bd8bda386e02..369fe5642799 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c | |||
@@ -318,31 +318,29 @@ static struct zram_meta *zram_meta_alloc(u64 disksize) | |||
318 | { | 318 | { |
319 | size_t num_pages; | 319 | size_t num_pages; |
320 | struct zram_meta *meta = kmalloc(sizeof(*meta), GFP_KERNEL); | 320 | struct zram_meta *meta = kmalloc(sizeof(*meta), GFP_KERNEL); |
321 | |||
321 | if (!meta) | 322 | if (!meta) |
322 | goto out; | 323 | return NULL; |
323 | 324 | ||
324 | num_pages = disksize >> PAGE_SHIFT; | 325 | num_pages = disksize >> PAGE_SHIFT; |
325 | meta->table = vzalloc(num_pages * sizeof(*meta->table)); | 326 | meta->table = vzalloc(num_pages * sizeof(*meta->table)); |
326 | if (!meta->table) { | 327 | if (!meta->table) { |
327 | pr_err("Error allocating zram address table\n"); | 328 | pr_err("Error allocating zram address table\n"); |
328 | goto free_meta; | 329 | goto out_error; |
329 | } | 330 | } |
330 | 331 | ||
331 | meta->mem_pool = zs_create_pool(GFP_NOIO | __GFP_HIGHMEM); | 332 | meta->mem_pool = zs_create_pool(GFP_NOIO | __GFP_HIGHMEM); |
332 | if (!meta->mem_pool) { | 333 | if (!meta->mem_pool) { |
333 | pr_err("Error creating memory pool\n"); | 334 | pr_err("Error creating memory pool\n"); |
334 | goto free_table; | 335 | goto out_error; |
335 | } | 336 | } |
336 | 337 | ||
337 | return meta; | 338 | return meta; |
338 | 339 | ||
339 | free_table: | 340 | out_error: |
340 | vfree(meta->table); | 341 | vfree(meta->table); |
341 | free_meta: | ||
342 | kfree(meta); | 342 | kfree(meta); |
343 | meta = NULL; | 343 | return NULL; |
344 | out: | ||
345 | return meta; | ||
346 | } | 344 | } |
347 | 345 | ||
348 | static void update_position(u32 *index, int *offset, struct bio_vec *bvec) | 346 | static void update_position(u32 *index, int *offset, struct bio_vec *bvec) |