Skip to content

Commit e547c00

Browse files
committed
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>
1 parent db2f376 commit e547c00

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

drivers/of/overlay.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -488,20 +488,30 @@ static int build_changeset(struct overlay_changeset *ovcs)
488488
*/
489489
static struct device_node *find_target_node(struct device_node *info_node)
490490
{
491+
struct device_node *node;
491492
const char *path;
492493
u32 val;
493494
int ret;
494495

495496
ret = of_property_read_u32(info_node, "target", &val);
496-
if (!ret)
497-
return of_find_node_by_phandle(val);
497+
if (!ret) {
498+
node = of_find_node_by_phandle(val);
499+
if (!node)
500+
pr_err("find target, node: %pOF, phandle 0x%x not found\n",
501+
info_node, val);
502+
return node;
503+
}
498504

499505
ret = of_property_read_string(info_node, "target-path", &path);
500-
if (!ret)
501-
return of_find_node_by_path(path);
506+
if (!ret) {
507+
node = of_find_node_by_path(path);
508+
if (!node)
509+
pr_err("find target, node: %pOF, path '%s' not found\n",
510+
info_node, path);
511+
return node;
512+
}
502513

503-
pr_err("Failed to find target for node %p (%s)\n",
504-
info_node, info_node->name);
514+
pr_err("find target, node: %pOF, no target property\n", info_node);
505515

506516
return NULL;
507517
}

0 commit comments

Comments
 (0)