[U-Boot] [PATCH 5/5] dtoc: Correct the type widening code in fdt_fallback

Simon Glass sjg at chromium.org
Fri Jul 22 17:22:49 CEST 2016


This code does not match the fdt version in fdt.py. When dtoc is unable to
use the Python libfdt library, it uses the fallback version, which does not
widen arrays correctly.

Fix this to avoid a warning 'excess elements in array initialize' in
dt-platdata.c which happens on some platforms.

Reported-by: Tom Rini <trini at konsulko.com>
Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/dtoc/fdt_fallback.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/dtoc/fdt_fallback.py b/tools/dtoc/fdt_fallback.py
index 14decf3..9ed11e4 100644
--- a/tools/dtoc/fdt_fallback.py
+++ b/tools/dtoc/fdt_fallback.py
@@ -71,6 +71,12 @@ class Prop:
         if type(newprop.value) == list and type(self.value) != list:
             self.value = newprop.value
 
+        if type(self.value) == list and len(newprop.value) > len(self.value):
+            val = fdt_util.GetEmpty(self.type)
+            while len(self.value) < len(newprop.value):
+                self.value.append(val)
+
+
 class Node:
     """A device tree node
 
-- 
2.8.0.rc3.226.g39d4020



More information about the U-Boot mailing list