[PATCH 1/2] test: fit: Using variable 'old_dtb' before assignment

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Sat Dec 9 19:54:10 CET 2023


old_dtb can only be assumed initialized in the finally block
if it is assigned a value before the try statement.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 test/py/tests/test_fit.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py
index f45848484e..04f64fd4bc 100755
--- a/test/py/tests/test_fit.py
+++ b/test/py/tests/test_fit.py
@@ -390,10 +390,10 @@ def test_fit(u_boot_console):
 
 
     cons = u_boot_console
+    # We need to use our own device tree file. Remember to restore it
+    # afterwards.
+    old_dtb = cons.config.dtb
     try:
-        # We need to use our own device tree file. Remember to restore it
-        # afterwards.
-        old_dtb = cons.config.dtb
         mkimage = cons.config.build_dir + '/tools/mkimage'
         run_fit_test(mkimage)
     finally:
-- 
2.40.1



More information about the U-Boot mailing list