Skip to content

Commit d9a493b

Browse files
author
Phil Elwell
committed
dtoverlay: Create "/aliases" node when needed
Attempting to add an alias currently fails if there is no existing "/aliases" node. Prevent an error by creating one as necessary. See: raspberrypi/firmware#906 Signed-off-by: Phil Elwell <[email protected]>
1 parent b656524 commit d9a493b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

helpers/dtoverlay/dtoverlay.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,6 +1948,8 @@ int dtoverlay_set_alias(DTBLOB_T *dtb, const char *alias_name, const char *value
19481948
int node_off;
19491949

19501950
node_off = fdt_path_offset(dtb->fdt, "/aliases");
1951+
if (node_off < 0)
1952+
node_off = fdt_add_subnode(dtb->fdt, 0, "aliases");
19511953

19521954
return fdt_setprop_string(dtb->fdt, node_off, alias_name, value);
19531955
}

0 commit comments

Comments
 (0)