提交 e3ddc979 编写于 作者: C Christian Engelmayer 提交者: Vinod Koul

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: NChristian Engelmayer <cengelma@gmx.at>
Signed-off-by: NVinod Koul <vinod.koul@intel.com>
上级 51455ec4
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册