Skip to contentSkip to conversation

omap-dma: fix dma_pool resource leak in error paths

PATCH Applied Haotian Zhang 2 participants 2 messages Nov 3, 2025 – Dec 23, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 7bedaa553760 ("dmaengine: add OMAP DMA engine driver")
---
 drivers/dma/ti/omap-dma.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/dma/ti/omap-dma.c +4 -0
index 8c023c6e623a..73ed4b794630 100644
@@ -1808,6 +1808,8 @@ static int omap_dma_probe(struct platform_device *pdev)
 	if (rc) {
 		pr_warn("OMAP-DMA: failed to register slave DMA engine device: %d\n",
 			rc);
+		if (od->ll123_supported)
+			dma_pool_destroy(od->desc_pool);
 		omap_dma_free(od);
 		return rc;
 	}
@@ -1823,6 +1825,8 @@ static int omap_dma_probe(struct platform_device *pdev)
 		if (rc) {
 			pr_warn("OMAP-DMA: failed to register DMA controller\n");
 			dma_async_device_unregister(&od->ddev);
+			if (od->ll123_supported)
+				dma_pool_destroy(od->desc_pool);
 			omap_dma_free(od);
 		}
 	}
Signature · 1 line
2.50.1.windows.1
maintainer Applied
#1 lore raw
Quoted 8 lines · Haotian Zhang

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.

[...]

Applied, thanks!

[1/1] omap-dma: fix dma_pool resource leak in error paths

      commit: 7b28c670df4508a7cb1ee31cb159b4366fcc6d4b

Best regards,

Signature · 1 line
~Vinod