LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] zram: clean up zram_meta_alloc()
@ 2014-12-21 14:35 Sergey Senozhatsky
2014-12-29 3:02 ` Minchan Kim
0 siblings, 1 reply; 2+ messages in thread
From: Sergey Senozhatsky @ 2014-12-21 14:35 UTC (permalink / raw)
To: Minchan Kim; +Cc: Andrew Morton, Nitin Gupta, linux-kernel, Sergey Senozhatsky
a trivial clean up of zram_meta_alloc() error handling.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
drivers/block/zram/zram_drv.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index bd8bda3..369fe56 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)
{
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)
--
2.2.1.209.g41e5f3a
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] zram: clean up zram_meta_alloc()
2014-12-21 14:35 [PATCH] zram: clean up zram_meta_alloc() Sergey Senozhatsky
@ 2014-12-29 3:02 ` Minchan Kim
0 siblings, 0 replies; 2+ messages in thread
From: Minchan Kim @ 2014-12-29 3:02 UTC (permalink / raw)
To: Sergey Senozhatsky; +Cc: Andrew Morton, Nitin Gupta, linux-kernel
On Sun, Dec 21, 2014 at 11:35:41PM +0900, Sergey Senozhatsky wrote:
> a trivial clean up of zram_meta_alloc() error handling.
>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Acked-by: Minchan Kim <minchan@kernel.org>
--
Kind regards,
Minchan Kim
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-29 3:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-21 14:35 [PATCH] zram: clean up zram_meta_alloc() Sergey Senozhatsky
2014-12-29 3:02 ` Minchan Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).