linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] soc: imx: gpcv2: Fix clock disabling imbalance in error path
@ 2022-02-18 21:57 Laurent Pinchart
  2022-02-18 22:55 ` Lucas Stach
  2022-02-21  5:59 ` Shawn Guo
  0 siblings, 2 replies; 5+ messages in thread
From: Laurent Pinchart @ 2022-02-18 21:57 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Lucas Stach, Shawn Guo, Pengutronix Kernel Team, Sascha Hauer,
	Fabio Estevam, NXP Linux Team, Peng Fan, Marek Vasut

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>
---
 drivers/soc/imx/gpcv2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
index a7c92bdfc53b..295e465197df 100644
--- a/drivers/soc/imx/gpcv2.c
+++ b/drivers/soc/imx/gpcv2.c
@@ -477,7 +477,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;
 }
-- 
Regards,

Laurent Pinchart


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] soc: imx: gpcv2: Fix clock disabling imbalance in error path
  2022-02-18 21:57 [PATCH] soc: imx: gpcv2: Fix clock disabling imbalance in error path Laurent Pinchart
@ 2022-02-18 22:55 ` Lucas Stach
  2022-02-21  5:59 ` Shawn Guo
  1 sibling, 0 replies; 5+ messages in thread
From: Lucas Stach @ 2022-02-18 22:55 UTC (permalink / raw)
  To: Laurent Pinchart, linux-arm-kernel
  Cc: Shawn Guo, Pengutronix Kernel Team, Sascha Hauer, Fabio Estevam,
	NXP Linux Team, Peng Fan, Marek Vasut

Hi Laurent,

Thanks for catching this!

Am Freitag, dem 18.02.2022 um 23:57 +0200 schrieb Laurent Pinchart:
> 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>

> ---
>  drivers/soc/imx/gpcv2.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/soc/imx/gpcv2.c b/drivers/soc/imx/gpcv2.c
> index a7c92bdfc53b..295e465197df 100644
> --- a/drivers/soc/imx/gpcv2.c
> +++ b/drivers/soc/imx/gpcv2.c
> @@ -477,7 +477,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;
>  }



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] soc: imx: gpcv2: Fix clock disabling imbalance in error path
  2022-02-18 21:57 [PATCH] soc: imx: gpcv2: Fix clock disabling imbalance in error path Laurent Pinchart
  2022-02-18 22:55 ` Lucas Stach
@ 2022-02-21  5:59 ` Shawn Guo
  2022-02-21  6:29   ` Laurent Pinchart
  1 sibling, 1 reply; 5+ messages in thread
From: Shawn Guo @ 2022-02-21  5:59 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-arm-kernel, Lucas Stach, Pengutronix Kernel Team,
	Sascha Hauer, Fabio Estevam, NXP Linux Team, Peng Fan,
	Marek Vasut

On Fri, Feb 18, 2022 at 11:57:20PM +0200, Laurent Pinchart wrote:
> 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>

Applied, thanks!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] soc: imx: gpcv2: Fix clock disabling imbalance in error path
  2022-02-21  5:59 ` Shawn Guo
@ 2022-02-21  6:29   ` Laurent Pinchart
  2022-02-21  7:38     ` Shawn Guo
  0 siblings, 1 reply; 5+ messages in thread
From: Laurent Pinchart @ 2022-02-21  6:29 UTC (permalink / raw)
  To: Shawn Guo
  Cc: linux-arm-kernel, Lucas Stach, Pengutronix Kernel Team,
	Sascha Hauer, Fabio Estevam, NXP Linux Team, Peng Fan,
	Marek Vasut

Hello Shawn,

On Mon, Feb 21, 2022 at 01:59:29PM +0800, Shawn Guo wrote:
> On Fri, Feb 18, 2022 at 11:57:20PM +0200, Laurent Pinchart wrote:
> > 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>
> 
> Applied, thanks!

Thank you.

I've noticed that Lucas' reviewed-by tag didn't end up in the commit in
your imx/fixes branch. Depending on your rebase policy with that branch,
you may want to ammend the commit.

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] soc: imx: gpcv2: Fix clock disabling imbalance in error path
  2022-02-21  6:29   ` Laurent Pinchart
@ 2022-02-21  7:38     ` Shawn Guo
  0 siblings, 0 replies; 5+ messages in thread
From: Shawn Guo @ 2022-02-21  7:38 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-arm-kernel, Lucas Stach, Pengutronix Kernel Team,
	Sascha Hauer, Fabio Estevam, NXP Linux Team, Peng Fan,
	Marek Vasut

On Mon, Feb 21, 2022 at 08:29:24AM +0200, Laurent Pinchart wrote:
> Hello Shawn,
> 
> On Mon, Feb 21, 2022 at 01:59:29PM +0800, Shawn Guo wrote:
> > On Fri, Feb 18, 2022 at 11:57:20PM +0200, Laurent Pinchart wrote:
> > > 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>
> > 
> > Applied, thanks!
> 
> Thank you.
> 
> I've noticed that Lucas' reviewed-by tag didn't end up in the commit in
> your imx/fixes branch. Depending on your rebase policy with that branch,
> you may want to ammend the commit.

Oops!  Thanks for reminding, Laurent!  Fixed.

Shawn

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-21  7:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-18 21:57 [PATCH] soc: imx: gpcv2: Fix clock disabling imbalance in error path Laurent Pinchart
2022-02-18 22:55 ` Lucas Stach
2022-02-21  5:59 ` Shawn Guo
2022-02-21  6:29   ` Laurent Pinchart
2022-02-21  7:38     ` Shawn Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).