Received: by 10.223.185.116 with SMTP id b49csp3288595wrg; Sun, 18 Feb 2018 19:22:55 -0800 (PST) X-Google-Smtp-Source: AH8x227QprYew2vvlPUZvnv6YAqyfeVESEOB4bYqYncS8LuIYSX1rHrwCriVO44SfEN0RFTFz2j+ X-Received: by 10.98.194.201 with SMTP id w70mr10300766pfk.188.1519010575416; Sun, 18 Feb 2018 19:22:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519010575; cv=none; d=google.com; s=arc-20160816; b=TSRly3nIcyilhQgL1hs6M4IZM3sHjorORqh1HLZ2QbGSXKRLPbW/WmL6xHKuKBQv3r mVeE73VdPWu45kSzgH35jgC3GxNtfMkX9CfSH7WG0IotAeFXpQTmkLu3x665YZy9/tJn fmR+y81l1UNWF2Mf4gypT40C3Vo0Fr8my4kid633EgNwAUROB/lcCqv5gxjVde28MfJ0 FYwtJezQrvwS/pe1jBt4NR5WEk4KMmn4//OCi7TdinFTAkVsvAivEWRyRiEEkNglFI9n kn2q5ME3rP6F0gMGFCHsZ43BvmgKHiL8+kYEe77yDcXvETTnGSdCOejjYl0MyKjAOwEw VpNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=94Y2OGtDUgPYQIN0EAJ/TAOrO6lWIpMrWjZEvwizKS8=; b=pss2K0MKT0g1YyKYoNHGKlCFhxrDoPI+SrShk4Vsr+7psb1hOYGa83rrjzEOsBZY3M UxY+08GZw38Ut+Y19okQoh6Rt/NeMIQSOSlUDCN2t/E7rIhD+Q1PS2QXCdX1WiyeZJdE DTvZ09tCQ08qdi3i7p2p8ESdNyUN2i5lgUNv45QRtSLccBxtnvfjKYWNDCZK/8N7TVkW bEDlUqrXhA2SLgKiuZw/GvVYhTwss4F+WjFoFs/zVdkKvuXRUbNRhURbZMTpg1EIYFCr 9e1sX5844pSfseCm8TLBn+clSzcJa5zIOzUNC1fGqm6CbSE/91ODMz9DPe5LKH6hzrx7 J1iw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p5-v6si3843430plo.32.2018.02.18.19.22.40; Sun, 18 Feb 2018 19:22:55 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752364AbeBSDVo (ORCPT + 99 others); Sun, 18 Feb 2018 22:21:44 -0500 Received: from mail-ot0-f196.google.com ([74.125.82.196]:34466 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752200AbeBSDVm (ORCPT ); Sun, 18 Feb 2018 22:21:42 -0500 Received: by mail-ot0-f196.google.com with SMTP id 38so238536otg.1; Sun, 18 Feb 2018 19:21:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=94Y2OGtDUgPYQIN0EAJ/TAOrO6lWIpMrWjZEvwizKS8=; b=PIjiPgOUyCKSh6lVLULKRinIQeoamjfI0ioSzB/2R1YqWMJo3pguPozEpyyDzSR1SH nNb5tAFbtzFVJfA6yDgRHdsuJl6bj3jY7Zih6gc3/U2uTVk+cSW0q7lx0Ae6IzEWatCS vNPuNm30o/twv8OW6Epsj25WgDvgaqcsSwWz5GrOpRNySPwa3BznMrostRm/lGpSQ/LF SBrRKAS8fBZWzrk/hz42fEbz8pm0a93AuH99XsXRdigyJSACoAfh2HhPZTeQK5INxpU3 TNUjpW4QnM2ci6shC7dIgl3nd33kjZE8Vgn0uiTdeRC/E5gPNJts4VzD2fhsF3BcnLGz 43Sg== X-Gm-Message-State: APf1xPCbBJhYUKIzxGdt/9uw0OvkhwcedXYjocy23dqsa1dVqB9wj02L imdIK+Oq9dvKKAZF4NPV/A== X-Received: by 10.157.16.77 with SMTP id o13mr9662578oto.54.1519010502303; Sun, 18 Feb 2018 19:21:42 -0800 (PST) Received: from localhost (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.gmail.com with ESMTPSA id w126sm11207555oie.19.2018.02.18.19.21.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 18 Feb 2018 19:21:41 -0800 (PST) Date: Sun, 18 Feb 2018 21:21:41 -0600 From: Rob Herring To: frowand.list@gmail.com Cc: pantelis.antoniou@konsulko.com, Pantelis Antoniou , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, geert@linux-m68k.org Subject: Re: [PATCH v3 4/4] of: improve reporting invalid overlay target path Message-ID: <20180219032141.lapcr32f4zqulvvb@rob-hp-laptop> References: <1518672946-7310-1-git-send-email-frowand.list@gmail.com> <1518672946-7310-5-git-send-email-frowand.list@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1518672946-7310-5-git-send-email-frowand.list@gmail.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 14, 2018 at 09:35:46PM -0800, frowand.list@gmail.com wrote: > From: Frank Rowand > > Errors while developing the patch to create of_overlay_fdt_apply() > exposed inadequate error messages to debug problems when overlay > devicetree fragment nodes contain an invalid target path. Improve > the messages in find_target_node() to remedy this. > > Signed-off-by: Frank Rowand > --- > > changes from v2: > - add fragment node name as suggested by Geert > - existing error message printed short node name, thus not > discriminating between fragments; change to full node name > - existing error message printed node address, which is devicetree > internal debugging, not useful in an overlay apply error message; > remove node address from message > > drivers/of/overlay.c | 22 ++++++++++++++++------ > 1 file changed, 16 insertions(+), 6 deletions(-) > > diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c > index 5f6c5569e97d..852e566d7744 100644 > --- a/drivers/of/overlay.c > +++ b/drivers/of/overlay.c > @@ -488,20 +488,30 @@ static int build_changeset(struct overlay_changeset *ovcs) > */ > static struct device_node *find_target_node(struct device_node *info_node) > { > + struct device_node *node; > const char *path; > u32 val; > int ret; > > ret = of_property_read_u32(info_node, "target", &val); > - if (!ret) > - return of_find_node_by_phandle(val); > + if (!ret) { > + node = of_find_node_by_phandle(val); > + if (!node) > + pr_err("find target, node: %pOF, phandle 0x%x not found\n", I'm wondering if the core should print the error rather than having all the callers do it. The question is whether there are cases where failing is okay? I guess sometimes we use 0 to skip cells, but the core handle not printing an error in that case. Rob > + info_node, val); > + return node; > + } > > ret = of_property_read_string(info_node, "target-path", &path); > - if (!ret) > - return of_find_node_by_path(path); > + if (!ret) { > + node = of_find_node_by_path(path); > + if (!node) > + pr_err("find target, node: %pOF, path '%s' not found\n", > + info_node, path); > + return node; > + } > > - pr_err("Failed to find target for node %p (%s)\n", > - info_node, info_node->name); > + pr_err("find target, node: %pOF, no target property\n", info_node); > > return NULL; > } > -- > Frank Rowand >