]>
xen/arm: add missing noreturn attributes
authorNicola Vetrini <nicola.vetrini@bugseng.com>
Fri, 6 Jun 2025 21:27:08 +0000 (14:27 -0700)
committerStefano Stabellini <stefano.stabellini@amd.com>
Thu, 19 Jun 2025 00:40:42 +0000 (17:40 -0700)
The marked functions never return to their caller, but lack the
`noreturn' attribute.

Functions that never return should be declared with a `noreturn'
attribute.

The lack of `noreturn' causes a violation of MISRA C Rule 17.11 (not
currently accepted in Xen), and also Rule 2.1: "A project shall not
contain unreachable code". Depending on the compiler used and the
compiler optimization used, the lack of `noreturn' might lead to the
presence of unreachable code.

No functional change.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Signed-off-by: Victor Lira <victorm.lira@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
xen/arch/arm/efi/efi-boot.h
xen/arch/arm/include/asm/arm64/traps.h
xen/arch/arm/include/asm/processor.h
xen/arch/arm/setup.c

index d2a09ad3a1511911950524543613a5b3c1535069..ee80560e1322cd68d6e50a80130313a22475c5b8 100644 (file)
@@ -934,7 +934,7 @@ static void __init efi_arch_blexit(void)
         efi_bs->FreePool(memmap);
 }
 
-static void __init efi_arch_halt(void)
+static void noreturn __init efi_arch_halt(void)
 {
     stop_cpu();
 }
index 3be2fa69eea3727313f52a37e71ab3ea9cf14328..b7435c6e735e88ca4cfaa1677ef1060669dd820e 100644 (file)
@@ -6,7 +6,7 @@ void inject_undef64_exception(struct cpu_user_regs *regs);
 void do_sysreg(struct cpu_user_regs *regs,
                const union hsr hsr);
 
-void do_bad_mode(struct cpu_user_regs *regs, int reason);
+void noreturn do_bad_mode(struct cpu_user_regs *regs, int reason);
 
 #endif /* __ASM_ARM64_TRAPS__ */
 /*
index 9cbc4f911061cbb2203c56846c141067e9d9be24..92c8bc1a3125a684c83a3b2c36b4dcfdf08a7bc0 100644 (file)
@@ -571,7 +571,7 @@ extern register_t __cpu_logical_map[];
 #endif
 
 #ifndef __ASSEMBLY__
-void panic_PAR(uint64_t par);
+void noreturn panic_PAR(uint64_t par);
 
 /* Debugging functions are declared with external linkage to aid development. */
 void show_registers(const struct cpu_user_regs *regs);
index 734e23da4408623d621565d0269cfab2e7b40722..ed72317af3c5fa5f862dbb1335ca75e96beab838 100644 (file)
@@ -63,7 +63,7 @@ bool __read_mostly acpi_disabled;
 
 domid_t __read_mostly max_init_domid;
 
-static __used void init_done(void)
+static __used void noreturn init_done(void)
 {
     int rc;