lkml.org 
[lkml]   [2018]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v6 4/4] of: improve reporting invalid overlay target path
Date
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>
\
 
 \ /
  Last update: 2018-03-02 22:08    [W:0.029 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site