linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: fix clock global name usage.
@ 2019-05-24  7:27 Alexandre Mergnat
  2019-05-24 14:33 ` Stephen Boyd
  2019-06-11  6:46 ` wens Tsai
  0 siblings, 2 replies; 9+ messages in thread
From: Alexandre Mergnat @ 2019-05-24  7:27 UTC (permalink / raw)
  To: mturquette, sboyd
  Cc: linux-clk, linux-kernel, baylibre-upstreaming, Alexandre Mergnat,
	Jerome Brunet

A recent patch allows the clock framework to specify the parent
relationship with either the clk_hw pointer, the global name or through
Device Tree name.

But the global name isn't handled by the clk framework because the DT name
is considered valid even if it's NULL, so of_clk_get_hw() returns an
unexpected clock (the first clock specified in DT).

This can be fixed by calling of_clk_get_hw() only when DT name is not NULL.

Fixes: fc0c209c147f ("clk: Allow parents to be specified without string names")
Cc: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
---
 drivers/clk/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index bdb077ba59b9..9624a75e5a8d 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -368,7 +368,7 @@ static struct clk_core *clk_core_get(struct clk_core *core, u8 p_index)
 	const char *dev_id = dev ? dev_name(dev) : NULL;
 	struct device_node *np = core->of_node;
 
-	if (np && index >= 0)
+	if (name && np && index >= 0)
 		hw = of_clk_get_hw(np, index, name);
 
 	/*
-- 
2.17.1


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

end of thread, other threads:[~2019-06-13 17:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-24  7:27 [PATCH] clk: fix clock global name usage Alexandre Mergnat
2019-05-24 14:33 ` Stephen Boyd
2019-05-24 15:00   ` Jerome Brunet
2019-05-24 17:44     ` Stephen Boyd
2019-05-24 18:12       ` Jerome Brunet
2019-06-06 22:54         ` Stephen Boyd
2019-06-10  9:37           ` Jerome Brunet
2019-06-11  6:46 ` wens Tsai
2019-06-12 23:00   ` 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).