[PATCH 1/3] dmaengine: stm32-dmamux: Unregister the DMA router on removal

Tian Xuechen 202300460064 at mail.sdu.edu.cn
Fri Nov 27 03:33:30 PST 2026


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

The DMA router remains in the OF registry after its device-managed
data is released. Remove the routing entry when the device is
unbound.

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

Fixes: df7e762db5f6 ("dmaengine: Add STM32 DMAMUX driver")
Signed-off-by: Tian Xuechen <202300460064 at mail.sdu.edu.cn>
---
 drivers/dma/stm32/stm32-dmamux.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/dma/stm32/stm32-dmamux.c b/drivers/dma/stm32/stm32-dmamux.c
index 57318715d9f3..6f49d78bfe3d 100644
--- a/drivers/dma/stm32/stm32-dmamux.c
+++ b/drivers/dma/stm32/stm32-dmamux.c
@@ -389,8 +389,14 @@ static const struct of_device_id stm32_dmamux_match[] = {
 	{},
 };
 
+static void stm32_dmamux_remove(struct platform_device *pdev)
+{
+	of_dma_router_free(pdev->dev.of_node);
+}
+
 static struct platform_driver stm32_dmamux_driver = {
 	.probe	= stm32_dmamux_probe,
+	.remove	= stm32_dmamux_remove,
 	.driver = {
 		.name = "stm32-dmamux",
 		.of_match_table = stm32_dmamux_match,

-- 
2.43.0




More information about the linux-arm-kernel mailing list