diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index d02451f951cf..5b4ab94193c2 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -5391,8 +5391,10 @@ const char *of_clk_get_parent_name(const struct device_node *np, int index) count++; } /* We went off the end of 'clock-indices' without finding it */ - if (of_property_present(clkspec.np, "clock-indices") && !found) + if (of_property_present(clkspec.np, "clock-indices") && !found) { + of_node_put(clkspec.np); return NULL; + } if (of_property_read_string_index(clkspec.np, "clock-output-names", index,