scripts: sd_fusing: simplyfy the code structure in get_raw_binary_sector()
authorŁukasz Stelmach <l.stelmach@samsung.com>
Wed, 7 Aug 2024 06:34:33 +0000 (08:34 +0200)
committerŁukasz Stelmach <l.stelmach@samsung.com>
Wed, 4 Dec 2024 11:00:01 +0000 (12:00 +0100)
Simplify the structure introduced in 098472c46d ("scripts: sd_fusing:
Check the raw_binary_table attribute").

Change-Id: Iaf844529d7db2b1df28175689980f0f843e5b86e
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
sd_fusing.py

index bd9d56e382e55e2ebd77dfff64ec5d56eab491ab..72a090e1fd8eaaee6cbd31c6c7ff04f0f33fd6db 100755 (executable)
@@ -176,14 +176,14 @@ class SdFusingTarget:
         return [self.binaries.get(binary, None)]
 
     def get_raw_binary_sector(self, binary):
-        if hasattr(self, "raw_binary_table"):
-            for entry in self.raw_binary_table:
-                if entry['binaries'] == binary:
-                    return entry['start_sector'];
-            return None
-        else:
+        if not hasattr(self, "raw_binary_table"):
             return None
 
+        for entry in self.raw_binary_table:
+            if entry['binaries'] == binary:
+                return entry['start_sector'];
+        return None
+
     def ensure_parttable(self):
         logging.notice(f"Verifying that partition table on {Device} matches target specification")
         for partnum, part in enumerate(self.part_table, 1):