lkml.org 
[lkml]   [2014]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] regulator: remove unnecessary of_node_get() to parent
From
2014-09-10 17:23 GMT+08:00 Guodong Xu <guodong.xu@linaro.org>:
>
>
> On 09/10/2014 12:23 PM, Axel Lin wrote:
>> 2014-09-10 12:20 GMT+08:00 Axel Lin <axel.lin@ingics.com>:
>>> 2014-09-10 11:50 GMT+08:00 Guodong Xu <guodong.xu@linaro.org>:
>>>> These of_node_get() were added to balance refcount decrements inside of
>>>> of_find_node_by_name().
>>>> See: commit c92f5dd2c42f ("regulator: Add missing of_node_put()")
>>>>
>>>> However of_find_node_by_name() was then replaced by of_get_child_by_name(),
>>>> which doesn't call of_node_put() against its input parameter.
>>>>
>>>> So, need to remove these unnecessary of_node_get() calls.
>>>
>>> The of_node_get() and of_node_put() is a pair.
>>> You need to either keep both or remove both.
>>>
>>>
>>> BTW,
>>> I think either the comment of of_get_child_by_name() needs fix or the
>>> implementation
>>> needs fix. The implementation does not increment refcount.
>>
>> Ah, I see the of_node_get() and of_node_put() in __of_get_next_child.
>> So of_get_child_by_name() is correct.(both comment and implementation)
>>
>
> That's right. You only need to call of_node_put() once on the node
> of_get_child_by_name() returns. That's why I submit this patch to remove
> of_node_get() _before_ calling to of_get_child_by_name().

Reviewed-by: Axel Lin <axel.lin@ingics.com>

Thanks,
Axel


\
 
 \ /
  Last update: 2014-09-10 12:21    [W:0.042 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site