Skip to content

Commit fec7ae2

Browse files
robherringgregkh
authored andcommitted
ARM: zImage: atags_to_fdt: Fix node names on added root nodes
commit 30596ae upstream. Commit 7536c7e ("of/fdt: Remove redundant kbasename function call") exposed a bug creating DT nodes in the ATAGS to DT fixup code. Non-existent nodes would mistaken get created with a leading '/'. The problem was fdt_path_offset() takes a full path while creating a node with fdt_add_subnode() takes just the basename. Since this we only add root child nodes, we can just skip over the '/'. Fixes: 7536c7e ("of/fdt: Remove redundant kbasename function call") Reported-by: Chris Packham <[email protected]> Cc: Qi Zheng <[email protected]> Cc: Russell King <[email protected]> Signed-off-by: Rob Herring <[email protected]> Tested-by: Chris Packham <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 69da790 commit fec7ae2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/arm/boot/compressed/atags_to_fdt.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ static int node_offset(void *fdt, const char *node_path)
1515
{
1616
int offset = fdt_path_offset(fdt, node_path);
1717
if (offset == -FDT_ERR_NOTFOUND)
18-
offset = fdt_add_subnode(fdt, 0, node_path);
18+
/* Add the node to root if not found, dropping the leading '/' */
19+
offset = fdt_add_subnode(fdt, 0, node_path + 1);
1920
return offset;
2021
}
2122

0 commit comments

Comments
 (0)