DMA Engine development
 help / color / mirror / Atom feed
* [PATCH] dmaengine: ep93xx: Withdraw the DMA providers on removal
@ 2026-11-28 11:02 Tian Xuechen
  2026-12-01 19:29 ` Alexander Sverdlin
  2026-12-01 19:41 ` Frank Li
  0 siblings, 2 replies; 3+ messages in thread
From: Tian Xuechen @ 2026-11-28 11:02 UTC (permalink / raw)
  To: vkoul, alex, nikita.shubin, arnd; +Cc: Frank.Li, dmaengine, liguangshuo

From: Tian Xuechen <202300460064@mail.sdu.edu.cn>

The OF controller and DMA engine are still registered when devres
releases their channel data. Manage both registrations so the OF
controller is withdrawn first, followed by the DMA engine.

This issue was found by our static analysis tool under development.

Fixes: 2e7f55ce4302 ("dmaengine: cirrus: Convert to DT for Cirrus EP93xx")
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
 drivers/dma/ep93xx_dma.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/dma/ep93xx_dma.c b/drivers/dma/ep93xx_dma.c
index 8a0b66a7d886..dc11cf740edf 100644
--- a/drivers/dma/ep93xx_dma.c
+++ b/drivers/dma/ep93xx_dma.c
@@ -1539,28 +1539,19 @@ static int ep93xx_dma_probe(struct platform_device *pdev)
 		edma->hw_interrupt = m2p_hw_interrupt;
 	}
 
-	ret = dma_async_device_register(dma_dev);
+	ret = dmaenginem_async_device_register(dma_dev);
 	if (ret)
 		return ret;
 
-	if (edma->m2m) {
-		ret = of_dma_controller_register(pdev->dev.of_node, ep93xx_m2m_dma_of_xlate,
-						 edma);
-	} else {
-		ret = of_dma_controller_register(pdev->dev.of_node, ep93xx_m2p_dma_of_xlate,
-						 edma);
-	}
+	ret = devm_of_dma_controller_register(&pdev->dev, pdev->dev.of_node,
+					      edma->m2m ? ep93xx_m2m_dma_of_xlate :
+							  ep93xx_m2p_dma_of_xlate, edma);
 	if (ret)
-		goto err_dma_unregister;
+		return ret;
 
 	dev_info(dma_dev->dev, "EP93xx M2%s DMA ready\n", edma->m2m ? "M" : "P");
 
 	return 0;
-
-err_dma_unregister:
-	dma_async_device_unregister(dma_dev);
-
-	return ret;
 }
 
 static const struct ep93xx_edma_data edma_m2p = {

base-commit: 4dce97c6c265544342e716e62fd24bbb232590c5
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-01 19:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-28 11:02 [PATCH] dmaengine: ep93xx: Withdraw the DMA providers on removal Tian Xuechen
2026-12-01 19:29 ` Alexander Sverdlin
2026-12-01 19:41 ` Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox