From: Chaitanya Kulkarni Date: Tue, 22 Feb 2022 15:28:52 +0000 (-0800) Subject: null_blk: null_alloc_page() cleanup X-Git-Tag: v6.1-rc5~1621^2~28 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=df00b1d26c3c3ff9dae4b572a6ad878ab65334e1;p=platform%2Fkernel%2Flinux-starfive.git 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: Chaitanya Kulkarni Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220222152852.26043-3-kch@nvidia.com Signed-off-by: Jens Axboe --- diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 80f9a6b..05b1120 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -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)