[PATCH 4/9] arm64: sysreg: Don't run the end-of-file checks after an error
From: Fuad Tabba
Date: Mon Nov 23 2026 - 02:53:14 EST
fatal() ends the run with exit, but awk still runs the END rule after
it, and END checks the file as though it had been read to the end. An
error inside a block leaves that block open, so the error is followed by
a second, bogus one about a missing terminator.
Skip the END checks once fatal() has run.
Signed-off-by: Fuad Tabba <fuad.tabba@xxxxxxxxx>
---
arch/arm64/tools/gen-sysreg.awk | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/tools/gen-sysreg.awk b/arch/arm64/tools/gen-sysreg.awk
index 8ce4981273dd3..c4fa27cd9beff 100755
--- a/arch/arm64/tools/gen-sysreg.awk
+++ b/arch/arm64/tools/gen-sysreg.awk
@@ -19,6 +19,7 @@ function fatal(msg) {
}
printf "\n"
+ __fatal = 1
exit 1
}
@@ -116,6 +117,10 @@ BEGIN {
}
END {
+ # fatal() exits before the whole file is read, and exit still runs END.
+ if (__fatal)
+ exit 1
+
if (__current_block_depth != 0)
fatal("Missing terminator for " block_current() " block")
--
2.47.3