mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
51455ec4f0
commit
e3ddc97946
|
@ -539,6 +539,7 @@ static struct dma_async_tx_descriptor *edma_prep_dma_cyclic(
|
||||||
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");
|
||||||
return NULL;
|
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,
|
ret = edma_config_pset(chan, &edesc->pset[i], src_addr,
|
||||||
dst_addr, burst, dev_width, period_len,
|
dst_addr, burst, dev_width, period_len,
|
||||||
direction);
|
direction);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
|
kfree(edesc);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (direction == DMA_DEV_TO_MEM)
|
if (direction == DMA_DEV_TO_MEM)
|
||||||
dst_addr += period_len;
|
dst_addr += period_len;
|
||||||
|
|
Loading…
Reference in New Issue