Skip to content

Commit

Permalink
fdt: check more errors
Browse files Browse the repository at this point in the history
This catches a few more error cases in fdt building.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
npiggin authored and stewartsmith committed May 15, 2019
1 parent d7636a1 commit a8343d5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,20 @@ static int __create_dtb(void *fdt, size_t len,
const struct dt_node *root,
bool exclusive)
{
fdt_create(fdt, len);
save_err(fdt_create(fdt, len));
if (fdt_error)
goto err;

if (root == dt_root && !exclusive)
create_dtb_reservemap(fdt, root);
else
fdt_finish_reservemap(fdt);
save_err(fdt_finish_reservemap(fdt));

flatten_dt_node(fdt, root, exclusive);

save_err(fdt_finish(fdt));
if (fdt_error) {
err:
prerror("dtb: error %s\n", fdt_strerror(fdt_error));
return fdt_error;
}
Expand Down

0 comments on commit a8343d5

Please sign in to comment.