From: Simon Glass <sjg@chromium.org>
Date: Fri, 22 Jul 2016 15:22:49 +0000 (-0600)
Subject: dtoc: Correct the type widening code in fdt_fallback
X-Git-Tag: v2025.01-rc5-pxa1908~8895
X-Git-Url: http://git.dujemihanovic.xyz/%22/icons/right.gif/static/%7B%7B%20%24image.RelPermalink%20%7D%7D?a=commitdiff_plain;h=d6a33918fb50fe2f3917b400cb84220b1d7e4392;p=u-boot.git

dtoc: Correct the type widening code in fdt_fallback

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@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Tom Rini <trini@konsulko.com>
---

diff --git a/tools/dtoc/fdt_fallback.py b/tools/dtoc/fdt_fallback.py
index 14decf394d..9ed11e4cbf 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