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

Tian Xuechen 202300460064 at mail.sdu.edu.cn
Thu Nov 26 05:28:05 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: e5f4ae84be74 ("dmaengine: add driver for lpc18xx dmamux")
Signed-off-by: Tian Xuechen <202300460064 at mail.sdu.edu.cn>
---
 drivers/dma/lpc18xx-dmamux.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/dma/lpc18xx-dmamux.c b/drivers/dma/lpc18xx-dmamux.c
index 40a338f0d44b..412d425dc1ab 100644
--- a/drivers/dma/lpc18xx-dmamux.c
+++ b/drivers/dma/lpc18xx-dmamux.c
@@ -169,6 +169,11 @@ static int lpc18xx_dmamux_probe(struct platform_device *pdev)
 				      &dmamux->dmarouter);
 }
 
+static void lpc18xx_dmamux_remove(struct platform_device *pdev)
+{
+	of_dma_router_free(pdev->dev.of_node);
+}
+
 static const struct of_device_id lpc18xx_dmamux_match[] = {
 	{ .compatible = "nxp,lpc1850-dmamux" },
 	{},
@@ -176,6 +181,7 @@ static const struct of_device_id lpc18xx_dmamux_match[] = {
 
 static struct platform_driver lpc18xx_dmamux_driver = {
 	.probe	= lpc18xx_dmamux_probe,
+	.remove	= lpc18xx_dmamux_remove,
 	.driver = {
 		.name = "lpc18xx-dmamux",
 		.of_match_table = lpc18xx_dmamux_match,

-- 
2.43.0




More information about the linux-arm-kernel mailing list