[PATCH v2 1/2] dmaengine: stm32-dma3: unregister the OF DMA provider on removal

From: Myeonghun Pak

Date: Mon Nov 09 2026 - 20:09:01 EST


Probe registers an OF DMA controller, but remove does not unregister it.
The OF DMA helpers retain the driver's data pointer after managed cleanup
frees it, leaving a stale provider entry for subsequent channel requests.

Unregister the OF DMA controller before tearing down the device resources.
There are no fallible operations after its registration in probe, so no
matching probe error path is needed.

Fixes: f561ec8b2b33 ("dmaengine: Add STM32 DMA3 support")

Co-developed-by: Ijae Kim <ae878000@xxxxxxxxx>
Signed-off-by: Ijae Kim <ae878000@xxxxxxxxx>
Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>
---
No hardware runtime testing.

diff --git a/drivers/dma/stm32/stm32-dma3.c b/drivers/dma/stm32/stm32-dma3.c
--- a/drivers/dma/stm32/stm32-dma3.c
+++ b/drivers/dma/stm32/stm32-dma3.c
@@ -1921,6 +1921,7 @@

static void stm32_dma3_remove(struct platform_device *pdev)
{
+ of_dma_controller_free(pdev->dev.of_node);
pm_runtime_disable(&pdev->dev);
}



On Tue, 10 Nov 2026 00:42:55 +0000, mhun512@xxxxxxxxx wrote:
> Split OF provider teardown from the managed clock cleanup requested in the
> review of the original patch. Patch 1 unregisters the provider on removal;
> patch 2 returns the active clock reference after managed DMA/IRQ teardown.
>
> Keep the existing remove-time runtime PM disable barrier. Check initial PM
> activation failure, and let devres handle later probe failures. Remove the
> manual IRQ-free loop from the original submission.
>
> No hardware runtime testing.