Skip to content

Commit 6d61aed

Browse files
pelwellpopcornmix
authored andcommitted
of: overlay: Correct symbol path fixups
When symbols from overlays are added to the live tree their paths must be rebased. The translated symbol is normally the result of joining the fragment-relative path (with a leading "/") to the target path (either copied directly from the "target-path" property or resolved from the phandle). This translation fails when the target is the root node (a common case for Raspberry Pi overlays) because the resulting path starts with a double slash. For example, if target-path is "/" and the fragment adds a node called "newnode", the label associated with that node will be assigned the path "//newnode", which can't be found in the tree. Fix the failure case by explicitly replacing a target path of "/" with an empty string. Fixes: d1651b0 ("of: overlay: add overlay symbols to live device tree") Signed-off-by: Phil Elwell <phil@raspberrypi.com>
1 parent cad9d01 commit 6d61aed

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎drivers/of/overlay.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ static struct property *dup_and_fixup_symbol_prop(
245245
if (!target_path)
246246
return NULL;
247247
target_path_len = strlen(target_path);
248+
if (!strcmp(target_path, "/"))
249+
target_path_len = 0;
248250

249251
new_prop = kzalloc(sizeof(*new_prop), GFP_KERNEL);
250252
if (!new_prop)

0 commit comments

Comments
 (0)