diff mbox

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

Message ID 1469200969-4643-5-git-send-email-sjg@chromium.org
State Accepted
Commit d6a33918fb50fe2f3917b400cb84220b1d7e4392
Delegated to: Tom Rini
Headers show

Commit Message

Simon Glass July 22, 2016, 3:22 p.m. UTC
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>
---

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

Comments

Tom Rini July 22, 2016, 10:05 p.m. UTC | #1
On Fri, Jul 22, 2016 at 09:22:49AM -0600, Simon Glass wrote:

> 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>
Tom Rini July 26, 2016, 2:33 a.m. UTC | #2
On Fri, Jul 22, 2016 at 09:22:49AM -0600, Simon Glass wrote:

> 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>

Applied to u-boot/master, thanks!
diff mbox

Patch

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