Skip to content

Commit 2378bf1

Browse files
windhlmpe
authored andcommitted
powerpc/powermac/udbg_scc: Add missing of_node_put()s in udbg_scc_init()
During the iteration of for_each_child_of_node(), we need to call of_node_put() for the old references stored in to 'ch_def' and 'ch_a' as their refcounters have been increased in last iteration. Signed-off-by: Liang He <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 11373c9 commit 2378bf1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

arch/powerpc/platforms/powermac/udbg_scc.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,14 @@ void __init udbg_scc_init(int force_scc)
8181
if (path != NULL)
8282
stdout = of_find_node_by_path(path);
8383
for_each_child_of_node(escc, ch) {
84-
if (ch == stdout)
84+
if (ch == stdout) {
85+
of_node_put(ch_def);
8586
ch_def = of_node_get(ch);
86-
if (of_node_name_eq(ch, "ch-a"))
87+
}
88+
if (of_node_name_eq(ch, "ch-a")) {
89+
of_node_put(ch_a);
8790
ch_a = of_node_get(ch);
91+
}
8892
}
8993
if (ch_def == NULL && !force_scc)
9094
goto bail;

0 commit comments

Comments
 (0)