Skip to content

Commit a8ea427

Browse files
windhlbebarino
authored andcommitted
clk: qoriq: Hold reference returned by of_get_parent()
In legacy_init_clockgen(), we need to hold the reference returned by of_get_parent() and use it to call of_node_put() for refcount balance. Beside, in create_sysclk(), we need to call of_node_put() on 'sysclk' also for refcount balance. Fixes: 0dfc86b ("clk: qoriq: Move chip-specific knowledge into driver") Signed-off-by: Liang He <windhl@126.com> Link: https://lore.kernel.org/r/20220628143851.171299-1-windhl@126.com Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent 1d6aa08 commit a8ea427

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/clk/clk-qoriq.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,8 +1063,13 @@ static void __init _clockgen_init(struct device_node *np, bool legacy);
10631063
*/
10641064
static void __init legacy_init_clockgen(struct device_node *np)
10651065
{
1066-
if (!clockgen.node)
1067-
_clockgen_init(of_get_parent(np), true);
1066+
if (!clockgen.node) {
1067+
struct device_node *parent_np;
1068+
1069+
parent_np = of_get_parent(np);
1070+
_clockgen_init(parent_np, true);
1071+
of_node_put(parent_np);
1072+
}
10681073
}
10691074

10701075
/* Legacy node */
@@ -1159,6 +1164,7 @@ static struct clk * __init create_sysclk(const char *name)
11591164
sysclk = of_get_child_by_name(clockgen.node, "sysclk");
11601165
if (sysclk) {
11611166
clk = sysclk_from_fixed(sysclk, name);
1167+
of_node_put(sysclk);
11621168
if (!IS_ERR(clk))
11631169
return clk;
11641170
}

0 commit comments

Comments
 (0)