Skip to content

Commit 7bbecd8

Browse files
mathieuchopstmcfriedt
authored andcommitted
scripts: kconfig: fix dt_nodelabel_int_prop crash if prop doesn't exist
dt_nodelabel_int_prop did not check if the property existed on the node before accessing it, which would result in a build-time crash (and thus build error) if used on a node which lacked the requested property. Fix by using the common _node_int_prop() helper which handles all edge cases properly. Signed-off-by: Mathieu Choplain <[email protected]>
1 parent 48d3aef commit 7bbecd8

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

scripts/kconfig/kconfigfunctions.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,7 @@ def dt_nodelabel_int_prop(kconf, _, label, prop):
547547
except edtlib.EDTError:
548548
return "0"
549549

550-
if not node or node.props[prop].type != "int":
551-
return "0"
552-
553-
if not node.props[prop].val:
554-
return "0"
555-
556-
return str(node.props[prop].val)
550+
return str(_node_int_prop(node, prop))
557551

558552
def dt_chosen_bool_prop(kconf, _, chosen, prop):
559553
"""

0 commit comments

Comments
 (0)