2022-06-20 10:19:31

by Peng Wu

[permalink] [raw]
Subject: [PATCH] bus: ti-sysc: Add missing of_node_put() in sysc_add_named_clock_from_child()

of_get_next_available_child() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
Add missing of_node_put() to avoid refcount leak.

Signed-off-by: Peng Wu <[email protected]>
Reported-by: Hulk Robot <[email protected]>
---
drivers/bus/ti-sysc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
index 9a7d12332fad..73fd42dd25b3 100644
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -333,6 +333,7 @@ static int sysc_add_named_clock_from_child(struct sysc *ddata,
return -ENODEV;

clock = devm_get_clk_from_child(ddata->dev, child, name);
+ of_node_put(child);
if (IS_ERR(clock))
return PTR_ERR(clock);

--
2.17.1


2022-06-28 06:13:55

by Tony Lindgren

[permalink] [raw]
Subject: Re: [PATCH] bus: ti-sysc: Add missing of_node_put() in sysc_add_named_clock_from_child()

* Peng Wu <[email protected]> [220620 12:32]:
> of_get_next_available_child() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when not need anymore.
> Add missing of_node_put() to avoid refcount leak.

Thanks applying into omap-for-v5.20/ti-sysc.

Tony