diff options
author | Christian Engelmayer <cengelma@gmx.at> | 2013-12-30 23:48:39 +0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2014-03-06 10:18:43 +0400 |
commit | e3ddc979465118b7ba46fed7cd10f4421edc3049 (patch) | |
tree | 2cb2d290e415d89338bacba5957eeda1a1fb7746 /drivers/dma | |
parent | 51455ec4f0d6aaff7371b51e8155e0d4bec1aca5 (diff) | |
download | linux-e3ddc979465118b7ba46fed7cd10f4421edc3049.tar.xz |
dma: edma: Fix memory leak in edma_prep_dma_cyclic()
Fix a memory leak in the edma_prep_dma_cyclic() error handling path.
Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/edma.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index cd8da451d199..cd04eb7b182e 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c @@ -539,6 +539,7 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic( 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"); return NULL; } @@ -553,8 +554,10 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic( ret = edma_config_pset(chan, &edesc->pset[i], src_addr, dst_addr, burst, dev_width, period_len, direction); - if (ret < 0) + if (ret < 0) { + kfree(edesc); return NULL; + } if (direction == DMA_DEV_TO_MEM) dst_addr += period_len; |