Skip to content

Commit 2e1136a

Browse files
ISCAS-Vulabvinodkoul
authored andcommitted
dmaengine: omap-dma: fix dma_pool resource leak in error paths
The dma_pool created by dma_pool_create() is not destroyed when dma_async_device_register() or of_dma_controller_register() fails, causing a resource leak in the probe error paths. Add dma_pool_destroy() in both error paths to properly release the allocated dma_pool resource. Fixes: 7bedaa5 ("dmaengine: add OMAP DMA engine driver") Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn> Link: https://patch.msgid.link/20251103073018.643-1-vulab@iscas.ac.cn Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 3f74700 commit 2e1136a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/dma/ti/omap-dma.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,6 +1808,8 @@ static int omap_dma_probe(struct platform_device *pdev)
18081808
if (rc) {
18091809
pr_warn("OMAP-DMA: failed to register slave DMA engine device: %d\n",
18101810
rc);
1811+
if (od->ll123_supported)
1812+
dma_pool_destroy(od->desc_pool);
18111813
omap_dma_free(od);
18121814
return rc;
18131815
}
@@ -1823,6 +1825,8 @@ static int omap_dma_probe(struct platform_device *pdev)
18231825
if (rc) {
18241826
pr_warn("OMAP-DMA: failed to register DMA controller\n");
18251827
dma_async_device_unregister(&od->ddev);
1828+
if (od->ll123_supported)
1829+
dma_pool_destroy(od->desc_pool);
18261830
omap_dma_free(od);
18271831
}
18281832
}

0 commit comments

Comments
 (0)