* [PATCH] genalloc: fix device node resource counter
@ 2014-09-24 19:51 Vladimir Zapolskiy
2014-09-24 20:58 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Zapolskiy @ 2014-09-24 19:51 UTC (permalink / raw)
To: linux-kernel; +Cc: Andrew Morton, Will Deacon, Olof Johansson, Catalin Marinas
The change balances a usage counter of np_pool device_node, which is
incremented on preceding of_parse_phandle() call.
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Olof Johansson <olof@lixom.net>
Cc: Catalin Marinas <catalin.marinas@arm.com>
---
lib/genalloc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/genalloc.c b/lib/genalloc.c
index c7a91cf..cce4dd6 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -637,6 +637,7 @@ struct gen_pool *of_get_named_gen_pool(struct device_node *np,
if (!np_pool)
return NULL;
pdev = of_find_device_by_node(np_pool);
+ of_node_put(np_pool);
if (!pdev)
return NULL;
return dev_get_gen_pool(&pdev->dev);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] genalloc: fix device node resource counter
2014-09-24 19:51 [PATCH] genalloc: fix device node resource counter Vladimir Zapolskiy
@ 2014-09-24 20:58 ` Andrew Morton
2014-09-25 11:04 ` Vladimir Zapolskiy
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2014-09-24 20:58 UTC (permalink / raw)
To: Vladimir Zapolskiy
Cc: linux-kernel, Will Deacon, Olof Johansson, Catalin Marinas
On Wed, 24 Sep 2014 22:51:00 +0300 Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> wrote:
> The change balances a usage counter of np_pool device_node, which is
> incremented on preceding of_parse_phandle() call.
>
> ...
>
> --- a/lib/genalloc.c
> +++ b/lib/genalloc.c
> @@ -637,6 +637,7 @@ struct gen_pool *of_get_named_gen_pool(struct device_node *np,
> if (!np_pool)
> return NULL;
> pdev = of_find_device_by_node(np_pool);
> + of_node_put(np_pool);
> if (!pdev)
> return NULL;
> return dev_get_gen_pool(&pdev->dev);
Looks good, thanks.
However... when fixing a bug, please always describe the end-user
visible effects of that bug. Amongst other things this is to help me
and others decide which kernel version(s) need the patch.
I'm assuming that the effect will be, at worst, a memory leak at the
rate of one device_node per hot-unplug event and is hence a very minor
thing?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] genalloc: fix device node resource counter
2014-09-24 20:58 ` Andrew Morton
@ 2014-09-25 11:04 ` Vladimir Zapolskiy
0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Zapolskiy @ 2014-09-25 11:04 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, Will Deacon, Olof Johansson, Catalin Marinas
Hi Andrew,
On 24.09.2014 23:58, Andrew Morton wrote:
> On Wed, 24 Sep 2014 22:51:00 +0300 Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> wrote:
>
>> The change balances a usage counter of np_pool device_node, which is
>> incremented on preceding of_parse_phandle() call.
>>
>> ...
>>
>> --- a/lib/genalloc.c
>> +++ b/lib/genalloc.c
>> @@ -637,6 +637,7 @@ struct gen_pool *of_get_named_gen_pool(struct device_node *np,
>> if (!np_pool)
>> return NULL;
>> pdev = of_find_device_by_node(np_pool);
>> + of_node_put(np_pool);
>> if (!pdev)
>> return NULL;
>> return dev_get_gen_pool(&pdev->dev);
>
> Looks good, thanks.
>
> However... when fixing a bug, please always describe the end-user
> visible effects of that bug. Amongst other things this is to help me
> and others decide which kernel version(s) need the patch.
>
> I'm assuming that the effect will be, at worst, a memory leak at the
> rate of one device_node per hot-unplug event and is hence a very minor
> thing?
>
yes, you are correct, moreover there are not so many users of
of_get_named_gen_pool() in vanilla (I counted 3), however since the
change is in ./lib folder, it may be considered as relatively important
one. I think it is sufficient to have the change in linux-next only.
With best wishes,
Vladimir
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-09-25 11:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-24 19:51 [PATCH] genalloc: fix device node resource counter Vladimir Zapolskiy
2014-09-24 20:58 ` Andrew Morton
2014-09-25 11:04 ` Vladimir Zapolskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox