edtlib: fix error handling in an internal helper

The error message emitted by _interrupt_parent() is wrong; it
mistakenly says:

  node None has an 'interrupts' property, but [...]

This 'None' is appearing because the same routine overwrites the
'node' argument that the caller is asking about with node parents
until it hits the root, at which point root.parent is None.

Fix it by caching the original node and using that in the error
message instead.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
This commit is contained in:
Martí Bolívar 2022-07-08 08:15:10 -07:00 committed by Kumar Gala
parent c6c7dde969
commit 19bb6b330c

View File

@ -2547,12 +2547,14 @@ def _interrupt_parent(node):
# the parents of 'node'. As of writing, this behavior isn't specified in
# the DT spec., but seems to match what some .dts files except.
start_node = node
while node:
if "interrupt-parent" in node.props:
return node.props["interrupt-parent"].to_node()
node = node.parent
_err(f"{node!r} has an 'interrupts' property, but neither the node "
_err(f"{start_node!r} has an 'interrupts' property, but neither the node "
f"nor any of its parents has an 'interrupt-parent' property")