Re: [PATCH 3/8] memory: stm32_omm: Depopulate child devices before disabling clocks

From: Lee Jones

Date: Wed Dec 02 2026 - 10:59:23 EST


On Wed, 02 Dec 2026, Patrice CHOTARD wrote:

>
>
> On 12/2/26 10:33, Lee Jones wrote:
> > stm32_omm_probe() registers child OSPI devices via
> > devm_of_platform_populate(), whose devres cleanup runs after
> > stm32_omm_remove() returns. When CR_MUXEN is set, stm32_omm_remove()
> > disables the OSPI child clocks while the child drivers are still bound
> > and may access their hardware during removal.
> >
> > Populate child devices with of_platform_populate() and explicitly call
> > of_platform_depopulate() on partial population failure and at the start
> > of stm32_omm_remove() before disabling the child clocks.
> >
> > Fixes: 8181d061dcff ("memory: Add STM32 Octo Memory Manager driver")
> > Closes: https://sashiko.dev/#/bug/linux-24c34b63-4c84-4d67-8ee1-eb7964079c44
> > Cc: stable@xxxxxxxxxxxxxxx
> > Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
> > ---
> > drivers/memory/stm32_omm.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/memory/stm32_omm.c b/drivers/memory/stm32_omm.c
> > index 3599683ab04a..5ff63870421f 100644
> > --- a/drivers/memory/stm32_omm.c
> > +++ b/drivers/memory/stm32_omm.c
> > @@ -368,8 +368,9 @@ static int stm32_omm_probe(struct platform_device *pdev)
> > return ret;
> > }
> >
> > - ret = devm_of_platform_populate(dev);
> > + ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
> > if (ret) {
> > + of_platform_depopulate(dev);
> > if (omm->cr & CR_MUXEN)
> > stm32_omm_toggle_child_clock(&pdev->dev, false);
> >
> > @@ -383,6 +384,8 @@ static void stm32_omm_remove(struct platform_device *pdev)
> > {
> > struct stm32_omm *omm = platform_get_drvdata(pdev);
> >
> > + of_platform_depopulate(&pdev->dev);
> > +
> > if (omm->cr & CR_MUXEN)
> > stm32_omm_toggle_child_clock(&pdev->dev, false);
> > }
>
> Hi Lee

Hey bud. I hope that you are well.

> Reviewed-by: Patrice Chotard <patrice.chotard@xxxxxxxxxxx>

Thanks for these.

--
Lee Jones