Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753788Ab3JMDPH (ORCPT ); Sat, 12 Oct 2013 23:15:07 -0400 Received: from mail-qa0-f53.google.com ([209.85.216.53]:36211 "EHLO mail-qa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753137Ab3JMDPF (ORCPT ); Sat, 12 Oct 2013 23:15:05 -0400 MIME-Version: 1.0 In-Reply-To: <5259B6F8.3070701@roeck-us.net> References: <5259B6F8.3070701@roeck-us.net> Date: Sat, 12 Oct 2013 22:15:03 -0500 Message-ID: Subject: Re: Usage of for_each_child_of_node() From: Rob Herring To: Guenter Roeck Cc: "devicetree@vger.kernel.org" , Grant Likely , Rob Herring , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1179 Lines: 31 On Sat, Oct 12, 2013 at 3:54 PM, Guenter Roeck wrote: > Hi all, > > for_each_child_of_node() and similar functions increase the refcount > on each returned node and expect the caller to release the node by > calling of_node_put() when done. > > Looking through the kernel code, it appears this is hardly ever done, > if at all. Some code even calls of_node_get() on returned nodes again. > > I guess this doesn't matter in cases where devicetree is a static entity. > However, this is not (or no longer) the case with devicetree overlays, > or more generically in cases where devicetree nodes are added and > removed dynamically. > > Fundamental question: Would patches to fix this problem be accepted upstream > ? Certainly. > Or, of course, stepping a bit back: Am I missing something essential ? No. I think this is frequently wrong since it typically doesn't matter for static entries as you mention. Rob -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/