From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752332AbaIJJXu (ORCPT ); Wed, 10 Sep 2014 05:23:50 -0400 Received: from mail-pd0-f175.google.com ([209.85.192.175]:35599 "EHLO mail-pd0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751497AbaIJJXs (ORCPT ); Wed, 10 Sep 2014 05:23:48 -0400 Message-ID: <541018A0.6070403@linaro.org> Date: Wed, 10 Sep 2014 17:23:44 +0800 From: Guodong Xu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Axel Lin CC: Mark Brown , Liam Girdwood , "linux-kernel@vger.kernel.org" , linux-arm-kernel , Support Opensource Subject: Re: [PATCH] regulator: remove unnecessary of_node_get() to parent References: <1410321039-26888-1-git-send-email-guodong.xu@linaro.org> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/10/2014 12:23 PM, Axel Lin wrote: > 2014-09-10 12:20 GMT+08:00 Axel Lin : >> 2014-09-10 11:50 GMT+08:00 Guodong Xu : >>> 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(). -Guodong From mboxrd@z Thu Jan 1 00:00:00 1970 From: guodong.xu@linaro.org (Guodong Xu) Date: Wed, 10 Sep 2014 17:23:44 +0800 Subject: [PATCH] regulator: remove unnecessary of_node_get() to parent In-Reply-To: References: <1410321039-26888-1-git-send-email-guodong.xu@linaro.org> Message-ID: <541018A0.6070403@linaro.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 09/10/2014 12:23 PM, Axel Lin wrote: > 2014-09-10 12:20 GMT+08:00 Axel Lin : >> 2014-09-10 11:50 GMT+08:00 Guodong Xu : >>> 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(). -Guodong