Commit c9d84b35 authored by Rakesh Pandit's avatar Rakesh Pandit Committed by Jens Axboe

lightnvm: pblk: fix error path in pblk_lines_alloc_metadata

Use appropriate memory free calls based on allocation type used and
also fix number of times free is called if kmalloc fails.
Signed-off-by: default avatarRakesh Pandit <rakesh@tuxera.com>
Reviewed-by: default avatarJavier González <javier@cnexlabs.com>
Signed-off-by: default avatarMatias Bjørling <m@bjorling.me>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent a96d50fa
...@@ -630,7 +630,10 @@ static int pblk_lines_alloc_metadata(struct pblk *pblk) ...@@ -630,7 +630,10 @@ static int pblk_lines_alloc_metadata(struct pblk *pblk)
fail_free_emeta: fail_free_emeta:
while (--i >= 0) { while (--i >= 0) {
if (l_mg->emeta_alloc_type == PBLK_VMALLOC_META)
vfree(l_mg->eline_meta[i]->buf); vfree(l_mg->eline_meta[i]->buf);
else
kfree(l_mg->eline_meta[i]->buf);
kfree(l_mg->eline_meta[i]); kfree(l_mg->eline_meta[i]);
} }
......
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