From: Simon Glass <sjg@chromium.org>
Date: Sun, 18 Oct 2015 01:41:15 +0000 (-0600)
Subject: fdt: Correct handling of alias regions
X-Git-Tag: v2025.01-rc5-pxa1908~11336
X-Git-Url: http://git.dujemihanovic.xyz/img/html/static/gitweb.css?a=commitdiff_plain;h=9d8ac956af304072dd11054e2b981ac3770ca49b;p=u-boot.git

fdt: Correct handling of alias regions

At present the last four bytes of the alias region are dropped in
the case where the last alias is included. This results in a corrupted
device tree. Fix this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

diff --git a/lib/libfdt/fdt_region.c b/lib/libfdt/fdt_region.c
index 9fea775a97..747d8bb86a 100644
--- a/lib/libfdt/fdt_region.c
+++ b/lib/libfdt/fdt_region.c
@@ -101,7 +101,7 @@ int fdt_add_alias_regions(const void *fdt, struct fdt_region *region, int count,
 			continue;
 		next = fdt_next_property_offset(fdt, offset);
 		if (next < 0)
-			next = node_end - sizeof(fdt32_t);
+			next = node_end;
 
 		if (!did_alias_header) {
 			fdt_add_region(info, base + node, 12);