Skip to content

Commit

Permalink
device_tree.c: Terminate the empty reservemap in create_device_tree()
Browse files Browse the repository at this point in the history
Device trees created with create_device_tree() may not have any
entries in their reservemap, because the FDT API requires that the
reservemap is completed before any FDT nodes are added, and
create_device_tree() itself creates a node.  However we were not
calling fdt_finish_reservemap(), which meant that there was no
terminator in the reservemap list and whatever happened to be at the
start of the FDT data section would end up being interpreted as
reservemap entries.  Avoid this by calling fdt_finish_reservemap()
to add the terminator.

Signed-off-by: Peter Maydell <[email protected]>
Acked-by: Alexander Graf <[email protected]>
Reviewed-by: Christoffer Dall <[email protected]>
Reviewed-by: Peter Crosthwaite <[email protected]>
Message-id: [email protected]
  • Loading branch information
pm215 committed Dec 10, 2013
1 parent 72b0cd3 commit ef6de70
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions device_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ void *create_device_tree(int *sizep)
if (ret < 0) {
goto fail;
}
ret = fdt_finish_reservemap(fdt);
if (ret < 0) {
goto fail;
}
ret = fdt_begin_node(fdt, "");
if (ret < 0) {
goto fail;
Expand Down

0 comments on commit ef6de70

Please sign in to comment.