diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c index 15b2787c3ddc..ae8cd6d5af8b 100644 --- a/drivers/lightnvm/pblk-init.c +++ b/drivers/lightnvm/pblk-init.c @@ -399,13 +399,15 @@ static int pblk_bb_discovery(struct nvm_tgt_dev *dev, struct pblk_lun *rlun) nr_blks = nvm_bb_tbl_fold(dev->parent, blks, nr_blks); if (nr_blks < 0) { - kfree(blks); ret = nr_blks; + goto out; } rlun->bb_list = blks; + return 0; out: + kfree(blks); return ret; }