dma: edma: Fix memory leak
When it fails to allocate a slot, edesc should be free'd before return; Signed-off-by: Valentin Ilie <valentin.ilie@gmail.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:
parent
18ebd564e4
commit
4b6271a644
|
@ -305,6 +305,7 @@ static struct dma_async_tx_descriptor *edma_prep_slave_sg(
|
||||||
edma_alloc_slot(EDMA_CTLR(echan->ch_num),
|
edma_alloc_slot(EDMA_CTLR(echan->ch_num),
|
||||||
EDMA_SLOT_ANY);
|
EDMA_SLOT_ANY);
|
||||||
if (echan->slot[i] < 0) {
|
if (echan->slot[i] < 0) {
|
||||||
|
kfree(edesc);
|
||||||
dev_err(dev, "Failed to allocate slot\n");
|
dev_err(dev, "Failed to allocate slot\n");
|
||||||
kfree(edesc);
|
kfree(edesc);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in a new issue