Skip to content
Browse files

edtlib: Check that 'status' has one of the values from the DT spec.

dtlib is meant to be general and anything-goes re. property values, but
edtlib can be pickier. Check that all 'status' properties have one of
the values listed in the devicetree specification
(, and error out otherwise.

This will get rid of the 'status = "ok"'s (should be "okay") that keep
cropping up.

Signed-off-by: Ulf Magnusson <>
  • Loading branch information...
ulfalizer authored and galak committed Aug 7, 2019
1 parent 6e5e1e0 commit acf276f1df79462d454ce5f518b07684fccd162c
Showing with 25 additions and 0 deletions.
  1. +25 −0 scripts/dts/
@@ -108,6 +108,7 @@ def __init__(self, dts, bindings_dirs):
self.bindings_dirs = bindings_dirs

self._dt = DT(dts)

@@ -1635,6 +1636,30 @@ def _slice(node, prop_name, size):
return [raw[i:i + size] for i in range(0, len(raw), size)]

def _check_dt(dt):
# Does devicetree sanity checks. dtlib is meant to be general and
# anything-goes except for very special properties like phandle, but in
# edtlib we can be pickier.

# Check that 'status' has one of the values given in the devicetree spec.

ok_status = {"okay", "disabled", "reserved", "fail", "fail-sss"}

for node in dt.node_iter():
if "status" in node.props:
status_val = node.props["status"].to_string()
except DTError as e:
# The error message gives the path

if status_val not in ok_status:
_err("unknown 'status' value \"{}\" in {} in {}, expected one "
"of {} (see the devicetree specification)"
.format(status_val, node.path, node.dt.filename,
", ".join(ok_status)))

def _err(msg):
raise EDTError(msg)

0 comments on commit acf276f

Please sign in to comment.
You can’t perform that action at this time.