diff options
author | Simon Glass <sjg@chromium.org> | 2021-07-28 19:23:10 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-08-01 09:05:24 -0600 |
commit | ca04494d76bf1152cd9ab1f67af5101c86e0824f (patch) | |
tree | fe4d76d9f16f939914bca1af05da83b05d055cdd /tools/dtoc/fdt.py | |
parent | df82de805172687e88dd7d72b68a9223b0a4c269 (diff) | |
download | u-boot-ca04494d76bf1152cd9ab1f67af5101c86e0824f.tar.gz u-boot-ca04494d76bf1152cd9ab1f67af5101c86e0824f.tar.bz2 u-boot-ca04494d76bf1152cd9ab1f67af5101c86e0824f.zip |
dtoc: Fix widening an int array to an int
An int array can hold a single int so we should not need to do anything
in the widening operation. However due to a quirk in the code, an int[3]
widened with an int produced an int[4]. Fix this and add a test.
Fix a comment typo while we are here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'tools/dtoc/fdt.py')
-rw-r--r-- | tools/dtoc/fdt.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index 9749966d5f..429e95f9a9 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -163,13 +163,14 @@ class Prop: self.value = new_value self.type = newprop.type - if type(newprop.value) == list and type(self.value) != list: - self.value = [self.value] - - if type(self.value) == list and len(newprop.value) > len(self.value): - val = self.GetEmpty(self.type) - while len(self.value) < len(newprop.value): - self.value.append(val) + if type(newprop.value) == list: + if type(self.value) != list: + self.value = [self.value] + + if len(newprop.value) > len(self.value): + val = self.GetEmpty(self.type) + while len(self.value) < len(newprop.value): + self.value.append(val) @classmethod def GetEmpty(self, type): |