diff mbox series

clk: imx: pll14xx: fix clk_pll14xx_wait_lock

Message ID 1573018178-14939-1-git-send-email-peng.fan@nxp.com (mailing list archive)
State Mainlined
Commit c3a5fd15ed0c1494435e4e35fbee734ae46b5073
Headers show
Series clk: imx: pll14xx: fix clk_pll14xx_wait_lock | expand

Commit Message

Peng Fan Nov. 6, 2019, 5:31 a.m. UTC
From: Peng Fan <peng.fan@nxp.com>

The usage of readl_poll_timeout is wrong, the cond should be
"val & LOCK_STATUS" not "val & LOCK_TIMEOUT_US".

Fixes: 8646d4dcc7fb ("clk: imx: Add PLLs driver for imx8mm soc")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---

V1:
 Hi Shawn,
   This patch is made based on 5.4-rc6, not your for-next branch,
   not sure whether this patch could catch 5.4 release.

 drivers/clk/imx/clk-pll14xx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Abel Vesa Nov. 6, 2019, 7:45 a.m. UTC | #1
On 19-11-06 05:31:15, Peng Fan wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> The usage of readl_poll_timeout is wrong, the cond should be
> "val & LOCK_STATUS" not "val & LOCK_TIMEOUT_US".
> 
> Fixes: 8646d4dcc7fb ("clk: imx: Add PLLs driver for imx8mm soc")
> Signed-off-by: Peng Fan <peng.fan@nxp.com>

Reviewed-by: Abel Vesa <abel.vesa@nxp.com>

> ---
> 
> V1:
>  Hi Shawn,
>    This patch is made based on 5.4-rc6, not your for-next branch,
>    not sure whether this patch could catch 5.4 release.
> 
>  drivers/clk/imx/clk-pll14xx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c
> index 7a815ec76aa5..d43b4a3c0de8 100644
> --- a/drivers/clk/imx/clk-pll14xx.c
> +++ b/drivers/clk/imx/clk-pll14xx.c
> @@ -153,7 +153,7 @@ static int clk_pll14xx_wait_lock(struct clk_pll14xx *pll)
>  {
>  	u32 val;
>  
> -	return readl_poll_timeout(pll->base, val, val & LOCK_TIMEOUT_US, 0,
> +	return readl_poll_timeout(pll->base, val, val & LOCK_STATUS, 0,
>  			LOCK_TIMEOUT_US);
>  }
>  
> -- 
> 2.16.4
>
Shawn Guo Dec. 4, 2019, 2:19 a.m. UTC | #2
On Wed, Nov 06, 2019 at 05:31:15AM +0000, Peng Fan wrote:
> From: Peng Fan <peng.fan@nxp.com>
> 
> The usage of readl_poll_timeout is wrong, the cond should be
> "val & LOCK_STATUS" not "val & LOCK_TIMEOUT_US".

Is this caught just by code inspection or a real world bug?  If you want
this get into -rc (and stable kernel) as a fix, you should add more
information about the bug, like how it's been triggered, what's the
consequence of the bug, and kernel dump message etc.

> 
> Fixes: 8646d4dcc7fb ("clk: imx: Add PLLs driver for imx8mm soc")
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
> 
> V1:
>  Hi Shawn,
>    This patch is made based on 5.4-rc6, not your for-next branch,

Please rebase it on 5.5-rc1 which will be coming next Monday.

>    not sure whether this patch could catch 5.4 release.

You can Cc stable kernel, so that it will be back ported.

Shawn

> 
>  drivers/clk/imx/clk-pll14xx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c
> index 7a815ec76aa5..d43b4a3c0de8 100644
> --- a/drivers/clk/imx/clk-pll14xx.c
> +++ b/drivers/clk/imx/clk-pll14xx.c
> @@ -153,7 +153,7 @@ static int clk_pll14xx_wait_lock(struct clk_pll14xx *pll)
>  {
>  	u32 val;
>  
> -	return readl_poll_timeout(pll->base, val, val & LOCK_TIMEOUT_US, 0,
> +	return readl_poll_timeout(pll->base, val, val & LOCK_STATUS, 0,
>  			LOCK_TIMEOUT_US);
>  }
>  
> -- 
> 2.16.4
>
Peng Fan Dec. 4, 2019, 2:22 a.m. UTC | #3
Hi Shawn,

> Subject: Re: [PATCH] clk: imx: pll14xx: fix clk_pll14xx_wait_lock
> 
> On Wed, Nov 06, 2019 at 05:31:15AM +0000, Peng Fan wrote:
> > From: Peng Fan <peng.fan@nxp.com>
> >
> > The usage of readl_poll_timeout is wrong, the cond should be "val &
> > LOCK_STATUS" not "val & LOCK_TIMEOUT_US".
> 
> Is this caught just by code inspection or a real world bug? 

Code inspection.

 If you want this
> get into -rc (and stable kernel) as a fix, you should add more information
> about the bug, like how it's been triggered, what's the consequence of the
> bug, and kernel dump message etc.
> 
> >
> > Fixes: 8646d4dcc7fb ("clk: imx: Add PLLs driver for imx8mm soc")
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >
> > V1:
> >  Hi Shawn,
> >    This patch is made based on 5.4-rc6, not your for-next branch,
> 
> Please rebase it on 5.5-rc1 which will be coming next Monday.

ok. I'll wait 5.5-rc1, then rebase and post v2.

> 
> >    not sure whether this patch could catch 5.4 release.
> 
> You can Cc stable kernel, so that it will be back ported.

ok.

Thanks,
Peng.

> 
> Shawn
> 
> >
> >  drivers/clk/imx/clk-pll14xx.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/clk/imx/clk-pll14xx.c
> > b/drivers/clk/imx/clk-pll14xx.c index 7a815ec76aa5..d43b4a3c0de8
> > 100644
> > --- a/drivers/clk/imx/clk-pll14xx.c
> > +++ b/drivers/clk/imx/clk-pll14xx.c
> > @@ -153,7 +153,7 @@ static int clk_pll14xx_wait_lock(struct
> > clk_pll14xx *pll)  {
> >  	u32 val;
> >
> > -	return readl_poll_timeout(pll->base, val, val & LOCK_TIMEOUT_US, 0,
> > +	return readl_poll_timeout(pll->base, val, val & LOCK_STATUS, 0,
> >  			LOCK_TIMEOUT_US);
> >  }
> >
> > --
> > 2.16.4
> >
diff mbox series

Patch

diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c
index 7a815ec76aa5..d43b4a3c0de8 100644
--- a/drivers/clk/imx/clk-pll14xx.c
+++ b/drivers/clk/imx/clk-pll14xx.c
@@ -153,7 +153,7 @@  static int clk_pll14xx_wait_lock(struct clk_pll14xx *pll)
 {
 	u32 val;
 
-	return readl_poll_timeout(pll->base, val, val & LOCK_TIMEOUT_US, 0,
+	return readl_poll_timeout(pll->base, val, val & LOCK_STATUS, 0,
 			LOCK_TIMEOUT_US);
 }