summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/core/ofnode.c2
-rw-r--r--include/dm/ofnode.h2
-rw-r--r--lib/of_live.c7
3 files changed, 8 insertions, 3 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index f9c9ca14a6..154c7b2667 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -356,7 +356,7 @@ const char *ofnode_get_name(ofnode node)
}
if (ofnode_is_np(node))
- return strrchr(node.np->full_name, '/') + 1;
+ return node.np->name;
return fdt_get_name(gd->fdt_blob, ofnode_to_offset(node), NULL);
}
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 9dcc1fed5b..1e23a40c99 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -466,7 +466,7 @@ ofnode ofnode_get_parent(ofnode node);
* ofnode_get_name() - get the name of a node
*
* @node: valid node to look up
- * Return: name of node
+ * Return: name of node (for the root node this is "")
*/
const char *ofnode_get_name(ofnode node);
diff --git a/lib/of_live.c b/lib/of_live.c
index 30cae9ab88..1b5964d09a 100644
--- a/lib/of_live.c
+++ b/lib/of_live.c
@@ -97,6 +97,10 @@ static void *unflatten_dt_node(const void *blob, void *mem, int *poffset,
char *fn;
fn = (char *)np + sizeof(*np);
+ if (new_format) {
+ np->name = pathp;
+ has_name = 1;
+ }
np->full_name = fn;
if (new_format) {
/* rebuild full path for new format */
@@ -202,7 +206,8 @@ static void *unflatten_dt_node(const void *blob, void *mem, int *poffset,
}
if (!dryrun) {
*prev_pp = NULL;
- np->name = of_get_property(np, "name", NULL);
+ if (!has_name)
+ np->name = of_get_property(np, "name", NULL);
np->type = of_get_property(np, "device_type", NULL);
if (!np->name)