Commit 4b6271a6 authored by Valentin Ilie's avatar Valentin Ilie Committed by Vinod Koul

dma: edma: Fix memory leak

When it fails to allocate a slot, edesc should be free'd before return;
Signed-off-by: default avatarValentin Ilie <valentin.ilie@gmail.com>
Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
parent 18ebd564
......@@ -305,6 +305,7 @@ static struct dma_async_tx_descriptor *edma_prep_slave_sg(
edma_alloc_slot(EDMA_CTLR(echan->ch_num),
EDMA_SLOT_ANY);
if (echan->slot[i] < 0) {
kfree(edesc);
dev_err(dev, "Failed to allocate slot\n");
kfree(edesc);
return NULL;
......
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