Initialize lib var per patch file and skip symbol handling when no
lib/drivers file header was seen. Avoids NameError exception when
processing patches that only touch docs or other paths.

Fixes: 1a0c104a7fa9 ("build: generate symbol maps")
Cc: [email protected]

Signed-off-by: Ali Alnubani <[email protected]>
---
 devtools/check-symbol-change.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/devtools/check-symbol-change.py b/devtools/check-symbol-change.py
index 1efeb82fcd..4cee4c765c 100755
--- a/devtools/check-symbol-change.py
+++ b/devtools/check-symbol-change.py
@@ -29,6 +29,7 @@
 symbols = {}
 
 for file in args.patch:
+    lib = None
     for ln in file.readlines():
         if file_header_regexp.match(ln):
             if file_header_regexp.match(ln).group(2) == "lib":
@@ -54,6 +55,8 @@
         else:
             continue
 
+        if lib is None:
+            continue
         if symbol not in symbols[lib]:
             symbols[lib][symbol] = {}
         added = ln[0] == "+"
-- 
2.53.0

Reply via email to