* [PATCH v2] bus/ti-sys: Fix refcount leak bugs
@ 2022-06-20 14:56 Liang He
2022-06-28 6:02 ` Tony Lindgren
0 siblings, 1 reply; 6+ messages in thread
From: Liang He @ 2022-06-20 14:56 UTC (permalink / raw)
To: tony, p.zabel; +Cc: windhl, linux-omap
In sysc_init_stdout_path(), there is only one of_node_put() for the
second of_find_node_by_path(). However, we need to add one of_node_put()
for the first of_find_node_by_path().
In sysc_init_static_data(), we need one of_node_put() for the
of_find_node_by_path() to keep refcount balance.
Signed-off-by: Liang He <windhl@126.com>
---
changelog:
v2: merge two bugs into one commit
v1: only find the bug in sysc_init_static_data()
drivers/bus/ti-sysc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
index 9a7d12332fad..85a1003eb8e2 100644
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -751,6 +751,7 @@ static void sysc_init_stdout_path(struct sysc *ddata)
goto err;
uart = of_get_property(np, "stdout-path", NULL);
+ of_node_put(np);
if (!uart)
goto err;
@@ -3138,6 +3139,7 @@ static int sysc_init_static_data(struct sysc *ddata)
np = of_find_node_by_path("/ocp");
WARN_ONCE(np && of_device_is_compatible(np, "simple-bus"),
"ti-sysc: Incomplete old dtb, please update\n");
+ of_node_put(np);
break;
default:
break;
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2] bus/ti-sys: Fix refcount leak bugs
2022-06-20 14:56 [PATCH v2] bus/ti-sys: Fix refcount leak bugs Liang He
@ 2022-06-28 6:02 ` Tony Lindgren
2022-06-28 6:09 ` Liang He
0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2022-06-28 6:02 UTC (permalink / raw)
To: Liang He; +Cc: p.zabel, linux-omap
* Liang He <windhl@126.com> [220620 17:51]:
> --- a/drivers/bus/ti-sysc.c
> +++ b/drivers/bus/ti-sysc.c
> @@ -751,6 +751,7 @@ static void sysc_init_stdout_path(struct sysc *ddata)
> goto err;
>
> uart = of_get_property(np, "stdout-path", NULL);
> + of_node_put(np);
> if (!uart)
> goto err;
>
Looks like you missed another of_node_put() after of_find_node_by_path()
in sysc_init_stdout_path(). Please add it and repost.
Thanks,
Tony
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re:Re: [PATCH v2] bus/ti-sys: Fix refcount leak bugs
2022-06-28 6:02 ` Tony Lindgren
@ 2022-06-28 6:09 ` Liang He
2022-06-28 6:24 ` Liang He
0 siblings, 1 reply; 6+ messages in thread
From: Liang He @ 2022-06-28 6:09 UTC (permalink / raw)
To: Tony Lindgren; +Cc: p.zabel, linux-omap
At 2022-06-28 14:02:07, "Tony Lindgren" <tony@atomide.com> wrote:
>* Liang He <windhl@126.com> [220620 17:51]:
>> --- a/drivers/bus/ti-sysc.c
>> +++ b/drivers/bus/ti-sysc.c
>> @@ -751,6 +751,7 @@ static void sysc_init_stdout_path(struct sysc *ddata)
>> goto err;
>>
>> uart = of_get_property(np, "stdout-path", NULL);
>> + of_node_put(np);
>> if (!uart)
>> goto err;
>>
>
>Looks like you missed another of_node_put() after of_find_node_by_path()
>in sysc_init_stdout_path(). Please add it and repost.
>
>Thanks,
>
>Tony
Thanks, I will resend a new patch soon.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re:Re:Re: [PATCH v2] bus/ti-sys: Fix refcount leak bugs
2022-06-28 6:09 ` Liang He
@ 2022-06-28 6:24 ` Liang He
2022-06-28 6:34 ` Tony Lindgren
0 siblings, 1 reply; 6+ messages in thread
From: Liang He @ 2022-06-28 6:24 UTC (permalink / raw)
To: Tony Lindgren; +Cc: p.zabel, linux-omap
At 2022-06-28 14:09:37, "Liang He" <windhl@126.com> wrote:
>
>
>
>At 2022-06-28 14:02:07, "Tony Lindgren" <tony@atomide.com> wrote:
>>* Liang He <windhl@126.com> [220620 17:51]:
>>> --- a/drivers/bus/ti-sysc.c
>>> +++ b/drivers/bus/ti-sysc.c
>>> @@ -751,6 +751,7 @@ static void sysc_init_stdout_path(struct sysc *ddata)
>>> goto err;
>>>
>>> uart = of_get_property(np, "stdout-path", NULL);
>>> + of_node_put(np);
>>> if (!uart)
>>> goto err;
>>>
>>
>>Looks like you missed another of_node_put() after of_find_node_by_path()
>>in sysc_init_stdout_path(). Please add it and repost.
>>
>>Thanks,
>>
>>Tony
>
>Thanks, I will resend a new patch soon.
Sorry, Tony.
I have re-checked the sysc_init_stdout_path(), I think the second of_node_put
is not needed as the second 'np' will be escaped out into global 'stdout_path'.
If my understanding is wrong, please correct me.
Thanks.
Liang
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re:Re: [PATCH v2] bus/ti-sys: Fix refcount leak bugs
2022-06-28 6:24 ` Liang He
@ 2022-06-28 6:34 ` Tony Lindgren
2022-07-04 7:23 ` Tony Lindgren
0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2022-06-28 6:34 UTC (permalink / raw)
To: Liang He; +Cc: p.zabel, linux-omap
* Liang He <windhl@126.com> [220628 06:19]:
> I have re-checked the sysc_init_stdout_path(), I think the second of_node_put
> is not needed as the second 'np' will be escaped out into global 'stdout_path'.
Yup you're right, thanks for checking it.
Regards,
Tony
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re:Re: [PATCH v2] bus/ti-sys: Fix refcount leak bugs
2022-06-28 6:34 ` Tony Lindgren
@ 2022-07-04 7:23 ` Tony Lindgren
0 siblings, 0 replies; 6+ messages in thread
From: Tony Lindgren @ 2022-07-04 7:23 UTC (permalink / raw)
To: Liang He; +Cc: p.zabel, linux-omap
* Tony Lindgren <tony@atomide.com> [220628 07:06]:
> * Liang He <windhl@126.com> [220628 06:19]:
> > I have re-checked the sysc_init_stdout_path(), I think the second of_node_put
> > is not needed as the second 'np' will be escaped out into global 'stdout_path'.
>
> Yup you're right, thanks for checking it.
Applying into omap-for-v5.20/ti-sysc thanks.
Tony
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-07-04 7:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-20 14:56 [PATCH v2] bus/ti-sys: Fix refcount leak bugs Liang He
2022-06-28 6:02 ` Tony Lindgren
2022-06-28 6:09 ` Liang He
2022-06-28 6:24 ` Liang He
2022-06-28 6:34 ` Tony Lindgren
2022-07-04 7:23 ` Tony Lindgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox