[PATCH] mfd: stm32-timers: depopulate child devices on populate failure
Pengpeng Hou
pengpeng at iscas.ac.cn
Sun Jun 14 23:30:41 PDT 2026
stm32_timers_probe() releases the timer DMA resources when
of_platform_populate() fails, but it does not depopulate any child
devices that were created before the failure.
The remove path explicitly depopulates child devices before releasing
DMA resources to avoid races with children using DMA. Apply the same
ordering on the populate failure path.
Signed-off-by: Pengpeng Hou <pengpeng at iscas.ac.cn>
---
drivers/mfd/stm32-timers.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c
index b3dbc02aaf79..1f0aecae83a5 100644
--- a/drivers/mfd/stm32-timers.c
+++ b/drivers/mfd/stm32-timers.c
@@ -329,8 +329,10 @@ static int stm32_timers_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ddata);
ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
- if (ret)
+ if (ret) {
+ of_platform_depopulate(&pdev->dev);
stm32_timers_dma_remove(dev, ddata);
+ }
return ret;
}
--
2.50.1 (Apple Git-155)
More information about the linux-arm-kernel
mailing list