[v4,1/2] clk: at91: fix clk-generated parenting
diff mbox

Message ID 20170512142531.11274-1-alexandre.belloni@free-electrons.com
State Superseded
Headers show

Commit Message

Alexandre Belloni May 12, 2017, 2:25 p.m. UTC
clk_generated_startup is called after clk_hw_register. So the first call to
get_parent will not have the correct value (i.e. 0) and because this is
cached, it may never be updated.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 drivers/clk/at91/clk-generated.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Stephen Boyd May 19, 2017, 1:33 a.m. UTC | #1
On 05/12, Alexandre Belloni wrote:
> clk_generated_startup is called after clk_hw_register. So the first call to
> get_parent will not have the correct value (i.e. 0) and because this is
> cached, it may never be updated.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---

Fixes tag?
Alexandre Belloni May 30, 2017, 9:50 a.m. UTC | #2
On 18/05/2017 at 18:33:02 -0700, Stephen Boyd wrote:
> On 05/12, Alexandre Belloni wrote:
> > clk_generated_startup is called after clk_hw_register. So the first call to
> > get_parent will not have the correct value (i.e. 0) and because this is
> > cached, it may never be updated.
> > 
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> > ---
> 
> Fixes tag?

Yep,

Fixes: df70aeef6083 ("clk: at91: add generated clock driver")

Can you add it or do you want a new version?
Stephen Boyd June 1, 2017, 7:47 a.m. UTC | #3
On 05/30, Alexandre Belloni wrote:
> On 18/05/2017 at 18:33:02 -0700, Stephen Boyd wrote:
> > On 05/12, Alexandre Belloni wrote:
> > > clk_generated_startup is called after clk_hw_register. So the first call to
> > > get_parent will not have the correct value (i.e. 0) and because this is
> > > cached, it may never be updated.
> > > 
> > > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> > > ---
> > 
> > Fixes tag?
> 
> Yep,
> 
> Fixes: df70aeef6083 ("clk: at91: add generated clock driver")
> 
> Can you add it or do you want a new version?
> 

I'll take care of it now and apply it to clk-next. The second
patch can go in after comments are addressed.

Patch
diff mbox

diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c
index 4e1cd5aa69d8..70474bd97a10 100644
--- a/drivers/clk/at91/clk-generated.c
+++ b/drivers/clk/at91/clk-generated.c
@@ -260,13 +260,12 @@  at91_clk_register_generated(struct regmap *regmap, spinlock_t *lock,
 	gck->lock = lock;
 	gck->range = *range;
 
+	clk_generated_startup(gck);
 	hw = &gck->hw;
 	ret = clk_hw_register(NULL, &gck->hw);
 	if (ret) {
 		kfree(gck);
 		hw = ERR_PTR(ret);
-	} else
-		clk_generated_startup(gck);
 
 	return hw;
 }