xen/x86: add missing noreturn attributes

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.

The usage of the noreturn attribute together with asmlinkage is only for
the benefit of the static analysis tools.

No functional change.

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
Signed-off-by: Victor Lira <victorm.lira@amd.com>
[stefano: improve commit message]
Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
This commit is contained in:
Nicola Vetrini authored and Stefano Stabellini committed 2025-06-18 17:40:42 -07:00
1 parent f143ff92e4
commit 3c36a5a0df
5 files changed
+6 -5

No files matched your search

+2 -1
View File
@@ -79,7 +79,8 @@ static int __init cf_check mce_set_verbosity(const char *str)
custom_param("mce_verbosity", mce_set_verbosity);
/* Handle unconfigured int18 (should never happen) */
static void cf_check unexpected_machine_check(const struct cpu_user_regs *regs)
static void noreturn cf_check
unexpected_machine_check(const struct cpu_user_regs *regs)
{
console_force_unlock();
printk("Unexpected Machine Check Exception\n");
+1 -1
View File
@@ -769,7 +769,7 @@ static void __init efi_arch_blexit(void)
efi_bs->FreePages(ucode.addr, PFN_UP(ucode.size));
}
static void __init efi_arch_halt(void)
static void noreturn __init efi_arch_halt(void)
{
local_irq_disable();
for ( ; ; )
+1 -1
View File
@@ -343,7 +343,7 @@ void __stop_this_cpu(void)
cpumask_clear_cpu(smp_processor_id(), &cpu_online_map);
}
static void cf_check stop_this_cpu(void *dummy)
static void noreturn cf_check stop_this_cpu(void *dummy)
{
const bool *stop_aps = dummy;
+1 -1
View File
@@ -805,7 +805,7 @@ void fatal_trap(const struct cpu_user_regs *regs, bool show_remote)
(regs->eflags & X86_EFLAGS_IF) ? "" : " IN INTERRUPT CONTEXT");
}
void asmlinkage do_unhandled_trap(struct cpu_user_regs *regs)
void asmlinkage noreturn do_unhandled_trap(struct cpu_user_regs *regs)
{
fatal_trap(regs, false);
}
+1 -1
View File
@@ -293,7 +293,7 @@ void show_page_walk(unsigned long addr)
l1_table_offset(addr), l1e_get_intpte(l1e), pfn);
}
void asmlinkage do_double_fault(struct cpu_user_regs *regs)
void asmlinkage noreturn do_double_fault(struct cpu_user_regs *regs)
{
unsigned int cpu;
struct extra_state state;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.