Skip to content

Commit

Permalink
mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_…
Browse files Browse the repository at this point in the history
…start

We should call of_node_put() for the reference 'uctl_node' returned by
of_get_parent() which will increase the refcount. Otherwise, there will
be a refcount leak bug.

Signed-off-by: Liang He <windhl@126.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
  • Loading branch information
Liang He authored and Thomas Bogendoerfer committed Jul 5, 2022
1 parent 5f7e2f3 commit 7a9f743
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion arch/mips/cavium-octeon/octeon-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ static void octeon2_usb_clocks_start(struct device *dev)
"refclk-frequency", &clock_rate);
if (i) {
dev_err(dev, "No UCTL \"refclk-frequency\"\n");
of_node_put(uctl_node);
goto exit;
}
i = of_property_read_string(uctl_node,
"refclk-type", &clock_type);

of_node_put(uctl_node);
if (!i && strcmp("crystal", clock_type) == 0)
is_crystal_clock = true;
}
Expand Down

0 comments on commit 7a9f743

Please sign in to comment.