Commit df00b1d2 authored by Chaitanya Kulkarni's avatar Chaitanya Kulkarni Committed by Jens Axboe

null_blk: null_alloc_page() cleanup

Remove goto labels and use direct returns as error unwinding code only
needs to free t_page variable if we alloc_pages() call fails as having
two labels for one kfree() can be avoided easily.
Signed-off-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220222152852.26043-3-kch@nvidia.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent c90b6b50
......@@ -783,18 +783,16 @@ static struct nullb_page *null_alloc_page(void)
t_page = kmalloc(sizeof(struct nullb_page), GFP_NOIO);
if (!t_page)
goto out;
return NULL;
t_page->page = alloc_pages(GFP_NOIO, 0);
if (!t_page->page)
goto out_freepage;
if (!t_page->page) {
kfree(t_page);
return NULL;
}
memset(t_page->bitmap, 0, sizeof(t_page->bitmap));
return t_page;
out_freepage:
kfree(t_page);
out:
return NULL;
}
static void null_free_page(struct nullb_page *t_page)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment