| From 2930d26b5209fbab5b81989d7b084847af89cb4f Mon Sep 17 00:00:00 2001 |
| From: Frank Rowand <frank.rowand@sony.com> |
| Date: Mon, 12 Feb 2018 00:25:04 -0800 |
| Subject: [PATCH 0937/1795] of: improve reporting invalid overlay target path |
| |
| 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> |
| (cherry picked from commit e547c0031697a0cb5ff7f4a66754fb3e082754ff) |
| Signed-off-by: Simon Horman <horms+renesas@verge.net.au> |
| Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> |
| --- |
| 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 585a5de1e329..5c64752d473b 100644 |
| --- a/drivers/of/overlay.c |
| +++ b/drivers/of/overlay.c |
| @@ -491,20 +491,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; |
| } |
| -- |
| 2.19.0 |
| |