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

Patrice CHOTARD patrice.chotard at foss.st.com
Wed Dec 2 05:54:17 PST 2026



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 at vger.kernel.org
> Signed-off-by: Lee Jones <lee at kernel.org>
> ---
>  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

Reviewed-by: Patrice Chotard <patrice.chotard at foss.st.com>

Thanks
Patrice



More information about the linux-arm-kernel mailing list