Re: [PATCH] mfd: stm32-timers: depopulate child devices on populate failure

From: Pengpeng Hou

Date: Fri Jul 03 2026 - 02:56:38 EST


Hi Lee,

Thanks for taking a look.

I checked devm_of_platform_populate(), but I don't think it covers this
particular failure path on its own.

devm_of_platform_populate() only installs the devres cleanup after
of_platform_populate() has returned success. If of_platform_populate()
returns an error after creating some earlier children, the helper just
frees its devres record and those partial children are not depopulated.

For stm32-timers, I think we still need the explicit ordering used by
remove: depopulate children before stm32_timers_dma_remove(). The child
drivers get the parent drvdata, and the PWM child can call the parent
stm32_timers_dma_burst_read() helper, so releasing the parent DMA
channels while partially-created children remain would keep the same
ordering problem the remove path avoids.

I agree the inline unwind is not the clearest form. I can send a v2
using a normal goto unwind label and a short comment explaining the
partial-populate case, unless you prefer a different shape.

Thanks,
Pengpeng