Free memory correctly when an allocation fails on a loop and we free
backwards previously successful allocations.
Signed-off-by: Javier González <javier@cnexlabs.com>
Reviewed-by: Matias Bjørling <matias@cnexlabs.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
return 0;
err:
- while (--i > lun_begin)
+ while (--i >= lun_begin)
clear_bit(i, dev->lun_map);
return -EBUSY;
return tgt_dev;
err_ch:
- while (--i > 0)
+ while (--i >= 0)
kfree(dev_map->chnls[i].lun_offs);
kfree(luns);
err_luns: