[PATCH] soc: imx93: fix missing clock disable in remove path

Haotian Zhang posted 1 patch 1 month, 1 week ago
drivers/pmdomain/imx/imx93-pd.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] soc: imx93: fix missing clock disable in remove path
Posted by Haotian Zhang 1 month, 1 week ago
The remove function never disables clocks that were enabled
in probe when the domain was initially on. The function
pm_genpd_remove() does not invoke the .power_off callback,
so clocks may remain prepared and enabled if the power domain
has not been powered off before removal.

Explicitly disable and unprepare the clocks in
imx93_pd_remove() to ensure proper resource cleanup.

Fixes: 0a0f7cc25d4a ("soc: imx: add i.MX93 SRC power domain driver")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
 drivers/pmdomain/imx/imx93-pd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pmdomain/imx/imx93-pd.c b/drivers/pmdomain/imx/imx93-pd.c
index d68273330687..da5b7b81dd98 100644
--- a/drivers/pmdomain/imx/imx93-pd.c
+++ b/drivers/pmdomain/imx/imx93-pd.c
@@ -91,6 +91,8 @@ static void imx93_pd_remove(struct platform_device *pdev)
 
 	of_genpd_del_provider(np);
 	pm_genpd_remove(&domain->genpd);
+	if (!(readl(domain->addr + MIX_FUNC_STAT_OFF) & FUNC_STAT_ISO_STAT_MASK))
+		clk_bulk_disable_unprepare(domain->num_clks, domain->clks);
 }
 
 static int imx93_pd_probe(struct platform_device *pdev)
-- 
2.50.1.windows.1
Re: [PATCH] soc: imx93: fix missing clock disable in remove path
Posted by Frank Li 1 month, 1 week ago
On Thu, Nov 06, 2025 at 11:08:22AM +0800, Haotian Zhang wrote:
> The remove function never disables clocks that were enabled
> in probe when the domain was initially on. The function
> pm_genpd_remove() does not invoke the .power_off callback,
> so clocks may remain prepared and enabled if the power domain
> has not been powered off before removal.
>
> Explicitly disable and unprepare the clocks in
> imx93_pd_remove() to ensure proper resource cleanup.
>
> Fixes: 0a0f7cc25d4a ("soc: imx: add i.MX93 SRC power domain driver")
> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
> ---
>  drivers/pmdomain/imx/imx93-pd.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/pmdomain/imx/imx93-pd.c b/drivers/pmdomain/imx/imx93-pd.c
> index d68273330687..da5b7b81dd98 100644
> --- a/drivers/pmdomain/imx/imx93-pd.c
> +++ b/drivers/pmdomain/imx/imx93-pd.c
> @@ -91,6 +91,8 @@ static void imx93_pd_remove(struct platform_device *pdev)
>
>  	of_genpd_del_provider(np);
>  	pm_genpd_remove(&domain->genpd);
> +	if (!(readl(domain->addr + MIX_FUNC_STAT_OFF) & FUNC_STAT_ISO_STAT_MASK))

Does it work if check struct generic_pm_domain::stay_on ?

Frank

> +		clk_bulk_disable_unprepare(domain->num_clks, domain->clks);
>  }
>
>  static int imx93_pd_probe(struct platform_device *pdev)
> --
> 2.50.1.windows.1
>