summaryrefslogtreecommitdiff
path: root/drivers/clk
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2022-01-14 07:26:38 +0300
committerJoel Stanley <joel@jms.id.au>2022-01-14 07:26:45 +0300
commita86c6a512f98e00938183ab1bb4504859a294433 (patch)
tree4279e934970303f820d3df34af16b9c24b6b5d60 /drivers/clk
parent2df0c7463236a6e19f020b0879285cac0e60c2f0 (diff)
parentd114b082bef784345bfac1e1d5c17257005284f2 (diff)
downloadlinux-a86c6a512f98e00938183ab1bb4504859a294433.tar.xz
Merge tag 'v5.15.14' into dev-5.15
This is the 5.15.14 stable release Signed-off-by: Joel Stanley <joel@jms.id.au>
Diffstat (limited to 'drivers/clk')
-rw-r--r--drivers/clk/clk.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 65508eb89ec9..a277fd4f2f0a 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -3415,6 +3415,14 @@ static int __clk_core_init(struct clk_core *core)
clk_prepare_lock();
+ /*
+ * Set hw->core after grabbing the prepare_lock to synchronize with
+ * callers of clk_core_fill_parent_index() where we treat hw->core
+ * being NULL as the clk not being registered yet. This is crucial so
+ * that clks aren't parented until their parent is fully registered.
+ */
+ core->hw->core = core;
+
ret = clk_pm_runtime_get(core);
if (ret)
goto unlock;
@@ -3579,8 +3587,10 @@ static int __clk_core_init(struct clk_core *core)
out:
clk_pm_runtime_put(core);
unlock:
- if (ret)
+ if (ret) {
hlist_del_init(&core->child_node);
+ core->hw->core = NULL;
+ }
clk_prepare_unlock();
@@ -3844,7 +3854,6 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw)
core->num_parents = init->num_parents;
core->min_rate = 0;
core->max_rate = ULONG_MAX;
- hw->core = core;
ret = clk_core_populate_parent_map(core, init);
if (ret)
@@ -3862,7 +3871,7 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw)
goto fail_create_clk;
}
- clk_core_link_consumer(hw->core, hw->clk);
+ clk_core_link_consumer(core, hw->clk);
ret = __clk_core_init(core);
if (!ret)