[PATCH 2/2] dmaengine: lpc32xx-dmamux: Unregister the DMA router on removal

Tian Xuechen 202300460064 at mail.sdu.edu.cn
Thu Nov 26 05:28:06 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: 5d318b595982 ("dmaengine: Add dma router for pl08x in LPC32XX SoC")
Signed-off-by: Tian Xuechen <202300460064 at mail.sdu.edu.cn>
---
 drivers/dma/lpc32xx-dmamux.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/dma/lpc32xx-dmamux.c b/drivers/dma/lpc32xx-dmamux.c
index 4fbeb3496acf..397640aacd8e 100644
--- a/drivers/dma/lpc32xx-dmamux.c
+++ b/drivers/dma/lpc32xx-dmamux.c
@@ -184,6 +184,11 @@ static int lpc32xx_dmamux_probe(struct platform_device *pdev)
 				      &dmamux->dmarouter);
 }
 
+static void lpc32xx_dmamux_remove(struct platform_device *pdev)
+{
+	of_dma_router_free(pdev->dev.of_node);
+}
+
 static const struct of_device_id lpc32xx_dmamux_match[] = {
 	{ .compatible = "nxp,lpc3220-dmamux" },
 	{},
@@ -191,6 +196,7 @@ static const struct of_device_id lpc32xx_dmamux_match[] = {
 
 static struct platform_driver lpc32xx_dmamux_driver = {
 	.probe	= lpc32xx_dmamux_probe,
+	.remove	= lpc32xx_dmamux_remove,
 	.driver = {
 		.name = "lpc32xx-dmamux",
 		.of_match_table = lpc32xx_dmamux_match,

-- 
2.43.0




More information about the linux-arm-kernel mailing list