linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: sunxi: Don't call clk_hw_get_name() on a hw that isn't registered
@ 2019-08-15  4:10 Stephen Boyd
  2019-08-15  8:01 ` Maxime Ripard
  2019-08-16 17:25 ` Stephen Boyd
  0 siblings, 2 replies; 4+ messages in thread
From: Stephen Boyd @ 2019-08-15  4:10 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-kernel, linux-clk, Maxime Ripard, Chen-Yu Tsai

The implementation of clk_hw_get_name() relies on the clk_core
associated with the clk_hw pointer existing. If of_clk_hw_register()
fails, there isn't a clk_core created yet, so calling clk_hw_get_name()
here fails. Extract the name first so we can print it later.

Fixes: 1d80c14248d6 ("clk: sunxi-ng: Add common infrastructure")
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
---
 drivers/clk/sunxi-ng/ccu_common.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu_common.c b/drivers/clk/sunxi-ng/ccu_common.c
index 7fe3ac980e5f..2e20e650b6c0 100644
--- a/drivers/clk/sunxi-ng/ccu_common.c
+++ b/drivers/clk/sunxi-ng/ccu_common.c
@@ -97,14 +97,15 @@ int sunxi_ccu_probe(struct device_node *node, void __iomem *reg,
 
 	for (i = 0; i < desc->hw_clks->num ; i++) {
 		struct clk_hw *hw = desc->hw_clks->hws[i];
+		const char *name;
 
 		if (!hw)
 			continue;
 
+		name = hw->init->name;
 		ret = of_clk_hw_register(node, hw);
 		if (ret) {
-			pr_err("Couldn't register clock %d - %s\n",
-			       i, clk_hw_get_name(hw));
+			pr_err("Couldn't register clock %d - %s\n", i, name);
 			goto err_clk_unreg;
 		}
 	}

base-commit: 5f9e832c137075045d15cd6899ab0505cfb2ca4b
-- 
Sent by a computer through tubes


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

* Re: [PATCH] clk: sunxi: Don't call clk_hw_get_name() on a hw that isn't registered
  2019-08-15  4:10 [PATCH] clk: sunxi: Don't call clk_hw_get_name() on a hw that isn't registered Stephen Boyd
@ 2019-08-15  8:01 ` Maxime Ripard
  2019-08-15 15:18   ` Stephen Boyd
  2019-08-16 17:25 ` Stephen Boyd
  1 sibling, 1 reply; 4+ messages in thread
From: Maxime Ripard @ 2019-08-15  8:01 UTC (permalink / raw)
  To: Stephen Boyd; +Cc: Michael Turquette, linux-kernel, linux-clk, Chen-Yu Tsai

On Wed, Aug 14, 2019 at 09:10:37PM -0700, Stephen Boyd wrote:
> The implementation of clk_hw_get_name() relies on the clk_core
> associated with the clk_hw pointer existing. If of_clk_hw_register()
> fails, there isn't a clk_core created yet, so calling clk_hw_get_name()
> here fails. Extract the name first so we can print it later.
>
> Fixes: 1d80c14248d6 ("clk: sunxi-ng: Add common infrastructure")
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

Do you want to apply it yourself, or should I merge this and send you
a PR later?

Thanks!
Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH] clk: sunxi: Don't call clk_hw_get_name() on a hw that isn't registered
  2019-08-15  8:01 ` Maxime Ripard
@ 2019-08-15 15:18   ` Stephen Boyd
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2019-08-15 15:18 UTC (permalink / raw)
  To: Maxime Ripard; +Cc: Michael Turquette, linux-kernel, linux-clk, Chen-Yu Tsai

Quoting Maxime Ripard (2019-08-15 01:01:46)
> On Wed, Aug 14, 2019 at 09:10:37PM -0700, Stephen Boyd wrote:
> > The implementation of clk_hw_get_name() relies on the clk_core
> > associated with the clk_hw pointer existing. If of_clk_hw_register()
> > fails, there isn't a clk_core created yet, so calling clk_hw_get_name()
> > here fails. Extract the name first so we can print it later.
> >
> > Fixes: 1d80c14248d6 ("clk: sunxi-ng: Add common infrastructure")
> > Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> > Cc: Chen-Yu Tsai <wens@csie.org>
> > Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> 
> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
> 
> Do you want to apply it yourself, or should I merge this and send you
> a PR later?
> 

I can apply it myself. Thanks! Now to figure out the real problem...

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

* Re: [PATCH] clk: sunxi: Don't call clk_hw_get_name() on a hw that isn't registered
  2019-08-15  4:10 [PATCH] clk: sunxi: Don't call clk_hw_get_name() on a hw that isn't registered Stephen Boyd
  2019-08-15  8:01 ` Maxime Ripard
@ 2019-08-16 17:25 ` Stephen Boyd
  1 sibling, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2019-08-16 17:25 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd
  Cc: linux-kernel, linux-clk, Maxime Ripard, Chen-Yu Tsai

Quoting Stephen Boyd (2019-08-14 21:10:37)
> The implementation of clk_hw_get_name() relies on the clk_core
> associated with the clk_hw pointer existing. If of_clk_hw_register()
> fails, there isn't a clk_core created yet, so calling clk_hw_get_name()
> here fails. Extract the name first so we can print it later.
> 
> Fixes: 1d80c14248d6 ("clk: sunxi-ng: Add common infrastructure")
> Cc: Maxime Ripard <maxime.ripard@bootlin.com>
> Cc: Chen-Yu Tsai <wens@csie.org>
> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
> ---

Applied to clk-next


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

end of thread, other threads:[~2019-08-16 17:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-15  4:10 [PATCH] clk: sunxi: Don't call clk_hw_get_name() on a hw that isn't registered Stephen Boyd
2019-08-15  8:01 ` Maxime Ripard
2019-08-15 15:18   ` Stephen Boyd
2019-08-16 17:25 ` Stephen Boyd

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).