From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCH 05/11] device tree: add device_tree_for_each_node() Date: Thu, 22 Mar 2012 12:47:33 +0000 Message-ID: <4F6B1F65.9090008@citrix.com> References: <1332179529-1828-1-git-send-email-david.vrabel@citrix.com> <1332179529-1828-6-git-send-email-david.vrabel@citrix.com> <1332414721.8817.67.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1332414721.8817.67.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On 22/03/12 11:12, Ian Campbell wrote: > On Mon, 2012-03-19 at 17:52 +0000, David Vrabel wrote: >> + for ( node = 0, depth = 0; >> + node >=0 && depth >= 0; >> + node = fdt_next_node(fdt, node, &depth) ) >> + { >> + if ( depth >= MAX_DEPTH ) >> + continue; > > Perhaps we should fail and return an error here (which the caller can > log with whatever facilities are available, e.g. early_printk or > printk)? Silently just not walking a bit of the tree seem liable to lead > to odd errors... Not sure about making it an error. May be best to make it a warning as at least in the early scan we want to try as hard as possible to get the memory and console info so we have a better chance of printing a diagnostic. I'm post a separate patch for this later because: a) it's unlikely a device tree will have a depth of more than 16 (the current device tree for the model is only 5 levels deep); and b) there is a test and a warning message when generating dom0's device tree (so unless your console and memory is 16 nodes deep you'll get a message). David