* [PATCH v2] clk: qoriq: Hold reference returned by of_get_parent()
@ 2022-06-28 14:38 Liang He
2022-08-19 21:41 ` Stephen Boyd
0 siblings, 1 reply; 2+ messages in thread
From: Liang He @ 2022-06-28 14:38 UTC (permalink / raw)
To: mturquette, sboyd, linux-clk, windhl
In legacy_init_clockgen(), we need to hold the reference returned
by of_get_parent() and use it to call of_node_put() for refcount
balance.
Beside, in create_sysclk(), we need to call of_node_put() on 'sysclk'
also for refcount balance.
Fixes: 0dfc86b3173f ("clk: qoriq: Move chip-specific knowledge into driver")
Signed-off-by: Liang He <windhl@126.com>
---
changelog:
v2: change 'tp' with 'parent_np', change title format to xx:yy:zz
v1: hold reference returned by of_get_parent() and |PUT| 'sysclk'
v1-link: https://lore.kernel.org/all/20220624101556.4164258-1-windhl@126.com/
Patched file has been compiled test in 5.19rc2.
drivers/clk/clk-qoriq.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c
index 88898b97a443..5eddb9f0d6bd 100644
--- a/drivers/clk/clk-qoriq.c
+++ b/drivers/clk/clk-qoriq.c
@@ -1063,8 +1063,13 @@ static void __init _clockgen_init(struct device_node *np, bool legacy);
*/
static void __init legacy_init_clockgen(struct device_node *np)
{
- if (!clockgen.node)
- _clockgen_init(of_get_parent(np), true);
+ if (!clockgen.node) {
+ struct device_node *parent_np;
+
+ parent_np = of_get_parent(np);
+ _clockgen_init(parent_np, true);
+ of_node_put(parent_np);
+ }
}
/* Legacy node */
@@ -1159,6 +1164,7 @@ static struct clk * __init create_sysclk(const char *name)
sysclk = of_get_child_by_name(clockgen.node, "sysclk");
if (sysclk) {
clk = sysclk_from_fixed(sysclk, name);
+ of_node_put(sysclk);
if (!IS_ERR(clk))
return clk;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] clk: qoriq: Hold reference returned by of_get_parent()
2022-06-28 14:38 [PATCH v2] clk: qoriq: Hold reference returned by of_get_parent() Liang He
@ 2022-08-19 21:41 ` Stephen Boyd
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2022-08-19 21:41 UTC (permalink / raw)
To: linux-clk, mturquette, windhl
Quoting Liang He (2022-06-28 07:38:51)
> In legacy_init_clockgen(), we need to hold the reference returned
> by of_get_parent() and use it to call of_node_put() for refcount
> balance.
>
> Beside, in create_sysclk(), we need to call of_node_put() on 'sysclk'
> also for refcount balance.
>
> Fixes: 0dfc86b3173f ("clk: qoriq: Move chip-specific knowledge into driver")
> Signed-off-by: Liang He <windhl@126.com>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-19 21:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-28 14:38 [PATCH v2] clk: qoriq: Hold reference returned by of_get_parent() Liang He
2022-08-19 21:41 ` Stephen Boyd
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.