From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751452AbdB1SDd (ORCPT ); Tue, 28 Feb 2017 13:03:33 -0500 Received: from bh-25.webhostbox.net ([208.91.199.152]:43163 "EHLO bh-25.webhostbox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751186AbdB1SD3 (ORCPT ); Tue, 28 Feb 2017 13:03:29 -0500 Date: Tue, 28 Feb 2017 09:26:37 -0800 From: Guenter Roeck To: Tony Lindgren Cc: Paul Walmsley , Rob Herring , Russell King , linux-kernel@vger.kernel.org, Qi Hou , linux-omap@vger.kernel.org, Peter Rosin , linux-arm-kernel@lists.infradead.org Subject: Re: ARM: OMAP2+: Grab reference to device nodes where needed Message-ID: <20170228172637.GA13455@roeck-us.net> References: <1486853948-20978-1-git-send-email-linux@roeck-us.net> <20170227233405.GA16546@roeck-us.net> <20170228162315.GS21809@atomide.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170228162315.GS21809@atomide.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Authenticated_sender: guenter@roeck-us.net X-OutGoing-Spam-Status: No, score=-1.0 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bh-25.webhostbox.net X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - roeck-us.net X-Get-Message-Sender-Via: bh-25.webhostbox.net: authenticated_id: guenter@roeck-us.net X-Authenticated-Sender: bh-25.webhostbox.net: guenter@roeck-us.net X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 28, 2017 at 08:23:16AM -0800, Tony Lindgren wrote: > * Guenter Roeck [170227 15:36]: > > ping ... this problem is now seen in mainline. > > Oops sorry I had accidentally tagged this with "next" instead of > "fixes". > > Looking at the patch though, can't we make of_node_get/put local to > omap3xxx_hwmod_is_hs_ip_block_usable()? > Not really. Strictly speaking the patch fixes two problems: 1) of_find_node_by_name() gets a reference on "bus", thus of_node_put() is necessary to release it. This is the change in omap3xxx_hwmod_init(). 2) of_find_node_by_name() drops a reference to the passed device node, thus it is necessary to call of_node_get(bus) in omap3xxx_hwmod_is_hs_ip_block_usable(). I should have stated that more clearly in the description. We could ignore 1) to get rid of the warning, but that would leave us with a dangling reference to the bus node. I could also improve the description, or split the patch in two. Let me know what you prefer. Another possible change would be to use of_get_child_by_name() instead of of_find_node_by_name(). That would, however, only search immediate children of the 'ocp' node, not all nodes. I think that is what is actually intended here, but I am not entirely sure. Thoughts ? Either case, turns out I'll have to re-submit the patch because, as mentioned above, of_find_node_by_name() gets a reference to the device node it returns, so a put on that node is necessary in omap3xxx_hwmod_is_hs_ip_block_usable(). Guenter