This is a note to let you know that I've just added the patch titled clk: ti: Balance of_node_get() calls for of_find_node_by_name() to the 6.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: clk-ti-balance-of_node_get-calls-for-of_find_node_by.patch and it can be found in the queue-6.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit e8fd4671ec76a6413c5844d36af977cb51be9b2c Author: Liang He <windhl@xxxxxxx> Date: Thu Sep 15 11:11:21 2022 +0800 clk: ti: Balance of_node_get() calls for of_find_node_by_name() [ Upstream commit 058a3996b888ab60eb1857fb4fd28f1b89a9a95a ] In ti_find_clock_provider(), of_find_node_by_name() will call of_node_put() for the 'from' argument, possibly putting the node one too many times. Let's maintain the of_node_get() from the previous search and only put when we're exiting the function early. This should avoid a misbalanced reference count on the node. Fixes: 51f661ef9a10 ("clk: ti: Add ti_find_clock_provider() to use clock-output-names") Signed-off-by: Liang He <windhl@xxxxxxx> Link: https://lore.kernel.org/r/20220915031121.4003589-1-windhl@xxxxxxx [sboyd@xxxxxxxxxx: Rewrite commit text, maintain reference instead of get again] Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c index 373e9438b57a..1dc2f15fb75b 100644 --- a/drivers/clk/ti/clk.c +++ b/drivers/clk/ti/clk.c @@ -140,11 +140,12 @@ static struct device_node *ti_find_clock_provider(struct device_node *from, break; } } - of_node_put(from); kfree(tmp); - if (found) + if (found) { + of_node_put(from); return np; + } /* Fall back to using old node name base provider name */ return of_find_node_by_name(from, name);