Received: by 10.223.185.116 with SMTP id b49csp2624150wrg; Mon, 12 Feb 2018 12:52:04 -0800 (PST) X-Google-Smtp-Source: AH8x225A9oS0wHAINI8qHKFHcUUI4GLS65khlsOHjeIbqM3ZqSMiM9rlogxjqRhEnBcyfUSEqlzA X-Received: by 10.98.68.129 with SMTP id m1mr12445404pfi.171.1518468724513; Mon, 12 Feb 2018 12:52:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518468724; cv=none; d=google.com; s=arc-20160816; b=wC2oI1YMI/Bdzj0toI9AYnbXOmJx7PDx0yyeIXzeJfpNwmAMPWk8xUJT97AJj2VE96 Ax7cEZ6dU0+lVb7Mxno4E+c1fLC+muk+6jvrqukfggSZUKz5EFGIrXU66OVGVnL6wsfm klrJiUF2tqTt2BHoPEzavQzu/sEflQL9t7/4QTx+wHazfO2qhBy+31N+jE7YQGk/hONq JGwuNlVvUjSaYC394jXXFgctRN+4ZZk/mqJ2h9JvA0pRyfaIAGGxgwGmb5Fq5vWKBHOJ js67ALYzvUCsTzKKoeRHJznV7qTAptjvgPalBeK9koKxVpSZMcuNWZVi1EY5RtbZgtdu YWdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=8OJcUM8+wNrlAnQii/OMzewCo7x87hHx8I3YHzUwg8E=; b=WPIIPzHi0f9NElcjWuDcOP2jsz0tdnBrSW3mZld9UMqt8+rWLOM1WFhgfUuLhphrhG wP2zJ+L8SlgYgbC3DNUq9r7vvWUfX5Zqh/61FT8Tu97Wn3u/EHX9Un+sp0jS4ACsTB+b /4cTmQNe6H/I5RYJf5VPH3GLRgmlIcbde3RBpT18d4VQmYfXT71HCVlcrXW0Ilk3ve4D V4mQ4sp+yLVneRuNorAUS0aZ6BkzC6OV5aXF2fwKGUTzFO7lSBL37cZ9FDTBjdkz1Kuz wf2v0CqtTl4dGXPghfXTFzGMQxNjA8aP57QAV3p4Vut9bUk7gT1JLWK8ZpwhP6PludTE Y3ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aWQ9bgtk; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si761811pgo.9.2018.02.12.12.51.49; Mon, 12 Feb 2018 12:52:04 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aWQ9bgtk; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753977AbeBLUvK (ORCPT + 99 others); Mon, 12 Feb 2018 15:51:10 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:55052 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753543AbeBLUvH (ORCPT ); Mon, 12 Feb 2018 15:51:07 -0500 Received: by mail-it0-f66.google.com with SMTP id k131so8386465ith.4; Mon, 12 Feb 2018 12:51:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=8OJcUM8+wNrlAnQii/OMzewCo7x87hHx8I3YHzUwg8E=; b=aWQ9bgtkC+0a076oDmFEfobyXiAESeBJst+97WyqoPRs7cECQz9+gsDAKVkgzKrnZ2 O3Y+tWF4q2+juvKIK/nchJWugW28GqcA+WAjqB7TRD7BaUIFXD+rCHPQUFE79Ild83xI xJSahNB2uBtbtxn9DLOsgHqxcHSQZD1b25Wv8QsGQujDLglJ0xTuCP1OUcJLAfeVsB53 PbXw/pksXRSkoG3spCr0idyvPD59xHE+lKlk7gi8AoZrYpzPoOuY9g71GS0nIi11Xvyy RCM236PaG7Z9wYiafHjz0ZYFzQxBtPgeSjyTMxsVkSmcnIgky44bxHh24OaqheNd/CsQ O1Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=8OJcUM8+wNrlAnQii/OMzewCo7x87hHx8I3YHzUwg8E=; b=mpSiCmC7JCpRR6Vo6pK6zMq7PngUNgmPQ4pJdTT2pehlIM98doqJ+Ar/Erq8J+YI1f MSCXSBaEK/1LFdJB8AdaGFzA04a1sXobdkL3ZON8kaORSnZerW0a+R8amrmtigaD+6py SWcE8MsHjxHbXaKathU14FVBSPEwZsps5ntfl/W3TBFfr5eCkbxY1eaAdPTNTBjoCDRW tOiuLgVH8mrSERPo0oXPDs6W+SVCOdZ/qCImzuqoZ+p7439uRZ1ivTmvJc/qUCaQl9Qw 5xTUiIduVH1IrU4qfOBauF04q53PTK/As+VO/Y75byXzmo1b6KVxdXyrzRSOhniXe+8E 0SgQ== X-Gm-Message-State: APf1xPATZNMrccJ91+POLTFhLg/6g9Ir7xlzACR+wWcHQcFlRaF/xLdX qfaauzDe3eBxsuXTCt3zkscwyrE1 X-Received: by 10.36.83.148 with SMTP id n142mr7125648itb.10.1518468667232; Mon, 12 Feb 2018 12:51:07 -0800 (PST) Received: from [192.168.1.70] (c-73-93-215-6.hsd1.ca.comcast.net. [73.93.215.6]) by smtp.gmail.com with ESMTPSA id a184sm3906538ioe.86.2018.02.12.12.51.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Feb 2018 12:51:06 -0800 (PST) Subject: Re: [PATCH v2 4/4] of: improve reporting invalid overlay target path To: Geert Uytterhoeven Cc: Rob Herring , Pantelis Antoniou , Pantelis Antoniou , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List References: <1518425496-12159-1-git-send-email-frowand.list@gmail.com> <1518425496-12159-5-git-send-email-frowand.list@gmail.com> From: Frank Rowand Message-ID: Date: Mon, 12 Feb 2018 12:51:05 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/12/18 01:00, Geert Uytterhoeven wrote: > Hi Frank, > > On Mon, Feb 12, 2018 at 9:51 AM, 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 > > Thanks for your patch! > >> --- a/drivers/of/overlay.c >> +++ b/drivers/of/overlay.c >> @@ -488,17 +488,26 @@ 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("target node find by phandle failed\n"); > > Do you want to print the actual node, cfr. below? That seems like a good idea. The name printed below is the (short) node name of the fragment, which seems useful. Will do, but will remove the pointer to the node, which is more of an internal debugging detail. >> + 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("target node find by path failed\n"); > > Likewise. Will do. >> + return node; >> + } >> >> pr_err("Failed to find target for node %p (%s)\n", >> info_node, info_node->name); > > This one prints more info. > > Gr{oetje,eeting}s, > > Geert > > -- > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org > > In personal conversations with technical people, I call myself a hacker. But > when I'm talking to journalists I just say "programmer" or something like that. > -- Linus Torvalds >