Skip to content

Commit f13c181

Browse files
committed
dtb: Handle multiple types differing in sign
If a property has multiple types differing in sign, drop the unsigned type. This prevents us from falling back to a 'uint32-array' which is now decoded differently. Same thing could happen for arrays or matrices, but ignore those for now. Signed-off-by: Rob Herring (Arm) <[email protected]>
1 parent c00f747 commit f13c181

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

dtschema/dtb.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ def prop_value(validator, nodename, p):
115115
if prop_types >= {'phandle', 'phandle-array'}:
116116
prop_types -= {'phandle'}
117117

118+
# Drop the unsigned type if both signed and unsigned type exists
119+
if prop_types >= {'int64', 'uint64'}:
120+
prop_types -= {'uint64'}
121+
if prop_types >= {'int32', 'uint32'}:
122+
prop_types -= {'uint32'}
123+
if prop_types >= {'int16', 'uint16'}:
124+
prop_types -= {'uint16'}
125+
if prop_types >= {'int8', 'uint8'}:
126+
prop_types -= {'uint8'}
127+
118128
if len(prop_types) > 1:
119129
if {'string', 'string-array'} & prop_types:
120130
str = bytes_to_string(data)

0 commit comments

Comments
 (0)