Skip to content

Commit a234c73

Browse files
committed
Merge tag 'dmaengine-fix-4.20-rc5' of git://git.infradead.org/users/vkoul/slave-dma
Pull dmaengine fixes from Vinod Koul: "This contains two fixes to at_hdmac which fixes long standing bus reported recently on serial transfers causing memory leak. These fixes were done by Richard Genoud" * tag 'dmaengine-fix-4.20-rc5' of git://git.infradead.org/users/vkoul/slave-dma: dmaengine: at_hdmac: fix module unloading dmaengine: at_hdmac: fix memory leak in at_dma_xlate()
2 parents 4b78317 + 77e75fd commit a234c73

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/dma/at_hdmac.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1641,6 +1641,12 @@ static void atc_free_chan_resources(struct dma_chan *chan)
16411641
atchan->descs_allocated = 0;
16421642
atchan->status = 0;
16431643

1644+
/*
1645+
* Free atslave allocated in at_dma_xlate()
1646+
*/
1647+
kfree(chan->private);
1648+
chan->private = NULL;
1649+
16441650
dev_vdbg(chan2dev(chan), "free_chan_resources: done\n");
16451651
}
16461652

@@ -1675,7 +1681,7 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec,
16751681
dma_cap_zero(mask);
16761682
dma_cap_set(DMA_SLAVE, mask);
16771683

1678-
atslave = devm_kzalloc(&dmac_pdev->dev, sizeof(*atslave), GFP_KERNEL);
1684+
atslave = kzalloc(sizeof(*atslave), GFP_KERNEL);
16791685
if (!atslave)
16801686
return NULL;
16811687

@@ -2000,6 +2006,8 @@ static int at_dma_remove(struct platform_device *pdev)
20002006
struct resource *io;
20012007

20022008
at_dma_off(atdma);
2009+
if (pdev->dev.of_node)
2010+
of_dma_controller_free(pdev->dev.of_node);
20032011
dma_async_device_unregister(&atdma->dma_common);
20042012

20052013
dma_pool_destroy(atdma->memset_pool);

0 commit comments

Comments
 (0)