summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/clk/clk.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 2db08c01ef51..02e75d4e0a77 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1108,16 +1108,17 @@ static u8 clk_fetch_parent_index(struct clk *clk, struct clk *parent)
static void clk_reparent(struct clk *clk, struct clk *new_parent)
{
- /* avoid duplicate POST_RATE_CHANGE notifications */
- if (new_parent->new_child == clk)
- new_parent->new_child = NULL;
-
hlist_del(&clk->child_node);
- if (new_parent)
+ if (new_parent) {
+ /* avoid duplicate POST_RATE_CHANGE notifications */
+ if (new_parent->new_child == clk)
+ new_parent->new_child = NULL;
+
hlist_add_head(&clk->child_node, &new_parent->children);
- else
+ } else {
hlist_add_head(&clk->child_node, &clk_orphan_list);
+ }
clk->parent = new_parent;
}