From 6e628c221ebf19a869542d31187e3ac29dba20fb Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 19 Feb 2025 08:11:16 -0700 Subject: tools: Fix pylint 3.3.4 errors This newer pylint produces errors about variables possibly being used before being set. Adjust the code to pass these checks. Signed-off-by: Simon Glass Reported-by: Tom Rini --- tools/binman/state.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools/binman/state.py') diff --git a/tools/binman/state.py b/tools/binman/state.py index 45bae40c525..6772d3678fe 100644 --- a/tools/binman/state.py +++ b/tools/binman/state.py @@ -406,10 +406,13 @@ def CheckSetHashValue(node, get_data_func): hash_node = node.FindNode('hash') if hash_node: algo = hash_node.props.get('algo').value + data = None if algo == 'sha256': m = hashlib.sha256() m.update(get_data_func()) data = m.digest() + if data is None: + raise ValueError(f"Node '{node.path}': Unknown hash algorithm '{algo}'") for n in GetUpdateNodes(hash_node): n.SetData('value', data) -- cgit v1.2.3