[PATCH v3 6/7] dmaengine: stm32-dmamux: Use managed DMA router registration

Tian Xuechen 202300460064 at mail.sdu.edu.cn
Fri Dec 4 04:16:29 PST 2026


The STM32 DMAMUX registers an OF DMA router backed by managed driver
data. The router entry can outlive that data when the device is
detached.

Use devm_of_dma_router_register() to remove the entry before devres
releases the router data. Keep the probe error unwind for runtime PM
and clocks when registration fails.

Fixes: df7e762db5f6 ("dmaengine: Add STM32 DMAMUX driver")
Cc: stable+noautosel at kernel.org # relies on new API
Signed-off-by: Tian Xuechen <202300460064 at mail.sdu.edu.cn>
---
 drivers/dma/stm32/stm32-dmamux.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/stm32/stm32-dmamux.c b/drivers/dma/stm32/stm32-dmamux.c
index b3cacd57b..3cb9d4051 100644
--- a/drivers/dma/stm32/stm32-dmamux.c
+++ b/drivers/dma/stm32/stm32-dmamux.c
@@ -290,8 +290,9 @@ static int stm32_dmamux_probe(struct platform_device *pdev)
 
 	pm_runtime_put(&pdev->dev);
 
-	ret = of_dma_router_register(node, stm32_dmamux_route_allocate,
-				     &stm32_dmamux->dmarouter);
+	ret = devm_of_dma_router_register(&pdev->dev, node,
+					  stm32_dmamux_route_allocate,
+					  &stm32_dmamux->dmarouter);
 	if (ret)
 		goto pm_disable;
 



More information about the linux-arm-kernel mailing list