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>
This commit is contained in:
parent
db2f3762d6
commit
e547c00316
|
@ -488,20 +488,30 @@ static int build_changeset(struct overlay_changeset *ovcs)
|
||||||
*/
|
*/
|
||||||
static struct device_node *find_target_node(struct device_node *info_node)
|
static struct device_node *find_target_node(struct device_node *info_node)
|
||||||
{
|
{
|
||||||
|
struct device_node *node;
|
||||||
const char *path;
|
const char *path;
|
||||||
u32 val;
|
u32 val;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = of_property_read_u32(info_node, "target", &val);
|
ret = of_property_read_u32(info_node, "target", &val);
|
||||||
if (!ret)
|
if (!ret) {
|
||||||
return of_find_node_by_phandle(val);
|
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);
|
ret = of_property_read_string(info_node, "target-path", &path);
|
||||||
if (!ret)
|
if (!ret) {
|
||||||
return of_find_node_by_path(path);
|
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",
|
pr_err("find target, node: %pOF, no target property\n", info_node);
|
||||||
info_node, info_node->name);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue