Skip to content
Snippets Groups Projects
Commit c1eb3d59 authored by Simon Glass's avatar Simon Glass
Browse files

dm: Fix error handling when unflattening the DT


The error handling code does not current detect an error right away.
Adjust it to return immediately.

Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
Tested-by: default avatarMarcel Ziswiler <marcel.ziswiler@toradex.com>
Tested-on: Beaver, Jetson-TK1
parent 0be3a3b4
No related branches found
No related tags found
No related merge requests found
......@@ -216,9 +216,12 @@ static void *unflatten_dt_node(const void *blob, void *mem, int *poffset,
*poffset = fdt_next_node(blob, *poffset, &depth);
if (depth < 0)
depth = 0;
while (*poffset > 0 && depth > old_depth)
while (*poffset > 0 && depth > old_depth) {
mem = unflatten_dt_node(blob, mem, poffset, np, NULL,
fpsize, dryrun);
if (!mem)
return NULL;
}
if (*poffset < 0 && *poffset != -FDT_ERR_NOTFOUND) {
debug("unflatten: error %d processing FDT\n", *poffset);
......@@ -286,6 +289,8 @@ static int unflatten_device_tree(const void *blob,
start = 0;
size = (unsigned long)unflatten_dt_node(blob, NULL, &start, NULL, NULL,
0, true);
if (!size)
return -EFAULT;
size = ALIGN(size, 4);
debug(" size is %lx, allocating...\n", size);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment