[PATCH 4/9] arm64: sysreg: Don't run the end-of-file checks after an error

Fuad Tabba fuad.tabba at linux.dev
Sun Nov 22 23:52:14 PST 2026


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 at linux.dev>
---
 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




More information about the linux-arm-kernel mailing list