linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: frowand.list@gmail.com
To: Rob Herring <robh+dt@kernel.org>,
	pantelis.antoniou@konsulko.com,
	Pantelis Antoniou <panto@antoniou-consulting.com>
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	geert@linux-m68k.org, laurent.pinchart+renesas@ideasonboard.com
Subject: [PATCH v7 5/5] of: improve reporting invalid overlay target path
Date: Sat,  3 Mar 2018 16:17:53 -0800	[thread overview]
Message-ID: <1520122673-11003-6-git-send-email-frowand.list@gmail.com> (raw)
In-Reply-To: <1520122673-11003-1-git-send-email-frowand.list@gmail.com>

From: Frank Rowand <frank.rowand@sony.com>

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 <frank.rowand@sony.com>
---

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 e3d7f69a8333..b930e05d1215 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",
+			       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 <frank.rowand@sony.com>

      parent reply	other threads:[~2018-03-04  0:19 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-04  0:17 [PATCH v7 0/5] of: change overlay apply input data from unflattened frowand.list
2018-03-04  0:17 ` [PATCH v7 1/5] x86: devicetree: fix config option around x86_flattree_get_config() frowand.list
2018-03-04  0:27   ` Frank Rowand
2018-03-04  7:20     ` Thomas Gleixner
2018-03-04  0:17 ` [PATCH v7 2/5] of: change overlay apply input data from unflattened to FDT frowand.list
2018-04-04 22:35   ` Jan Kiszka
2018-04-05  0:55     ` Rob Herring
2018-04-05  7:22       ` Jan Kiszka
2018-04-05 19:16         ` Frank Rowand
2018-04-05 19:26           ` Rob Herring
2018-04-05 19:37             ` Frank Rowand
2018-04-05 19:13       ` Frank Rowand
2018-04-05 19:17         ` Jan Kiszka
2018-04-05 18:59     ` Frank Rowand
2018-04-05 19:13       ` Jan Kiszka
2018-04-05 19:28         ` Frank Rowand
2018-04-05 19:38           ` Jan Kiszka
2018-04-05 20:33             ` Frank Rowand
2018-04-05 21:12           ` Rob Herring
2018-04-11  5:42             ` Jan Kiszka
2018-04-22 10:30               ` Jan Kiszka
2018-04-23 22:38                 ` Frank Rowand
2018-04-24  5:29                   ` Jan Kiszka
2018-04-24 16:08                     ` Alan Tull
2018-04-24 18:26                       ` Alan Tull
2018-04-25  5:38                         ` Jan Kiszka
2018-04-24 21:15                     ` Frank Rowand
2018-04-25  5:22                       ` Jan Kiszka
2018-04-25 18:56                         ` Frank Rowand
2018-04-25 19:02                           ` Frank Rowand
2018-04-25 19:40                             ` Jan Kiszka
2018-04-25 19:53                               ` Geert Uytterhoeven
2018-04-25 20:09                                 ` Jan Kiszka
2018-04-25 23:07                               ` Frank Rowand
2018-04-24 20:56                   ` Frank Rowand
2018-04-25  5:23                     ` Jan Kiszka
2018-04-25 18:40                       ` Frank Rowand
2018-04-25 20:07                         ` Jan Kiszka
2018-04-25 20:26                           ` Alan Tull
2018-04-26  0:20                           ` Frank Rowand
2018-04-25 14:59                     ` Alan Tull
2018-04-25 17:41                       ` Frank Rowand
2018-04-25 18:19                         ` Alan Tull
2018-04-26  0:07                           ` Frank Rowand
2018-04-26  0:10                             ` Frank Rowand
2018-03-04  0:17 ` [PATCH v7 3/5] of: Documentation: of_overlay_apply() replaced by of_overlay_fdt_apply() frowand.list
2018-03-04  0:17 ` [PATCH v7 4/5] of: convert unittest overlay devicetree source to sugar syntax frowand.list
2018-03-04  0:17 ` frowand.list [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1520122673-11003-6-git-send-email-frowand.list@gmail.com \
    --to=frowand.list@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pantelis.antoniou@konsulko.com \
    --cc=panto@antoniou-consulting.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).