]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
soc: imx: gpcv2: Fix clock disabling imbalance in error path
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 18 Feb 2022 21:57:20 +0000 (23:57 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Mar 2022 18:14:14 +0000 (19:14 +0100)
[ Upstream commit fa231bef3b34f1670b240409c11e59a3ce095e6d ]

The imx_pgc_power_down() starts by enabling the domain clocks, and thus
disables them in the error path. Commit 18c98573a4cf ("soc: imx: gpcv2:
add domain option to keep domain clocks enabled") made the clock enable
conditional, but forgot to add the same condition to the error path.
This can result in a clock enable/disable imbalance. Fix it.

Fixes: 18c98573a4cf ("soc: imx: gpcv2: add domain option to keep domain clocks enabled")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/soc/imx/gpcv2.c

index 8176380b02e6e7c2b04a8dbb57e522eff409126e..4415f07e1fa97f42dab025c17ec4f2d49d9f1f46 100644 (file)
@@ -382,7 +382,8 @@ static int imx_pgc_power_down(struct generic_pm_domain *genpd)
        return 0;
 
 out_clk_disable:
-       clk_bulk_disable_unprepare(domain->num_clks, domain->clks);
+       if (!domain->keep_clocks)
+               clk_bulk_disable_unprepare(domain->num_clks, domain->clks);
 
        return ret;
 }