From 96f26d15ee740318b43d196b618a756edad71cdd Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Sat, 14 Aug 2021 11:10:50 -0600 Subject: arch/x86: Make sure compiler knows we're stopping in hlt() Currently, static analyzers don't recognize that hlt() doesn't return, so they show errors like uninitialized variables assuming that it does return. This takes care of that problem. Signed-off-by: Martin Roth Change-Id: Ia2325700b10fe1f89d749edfe5aee72b47d02f2e Reviewed-on: https://review.coreboot.org/c/coreboot/+/56978 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held --- src/arch/x86/include/arch/hlt.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/arch') diff --git a/src/arch/x86/include/arch/hlt.h b/src/arch/x86/include/arch/hlt.h index 3709df2807..887c737b9c 100644 --- a/src/arch/x86/include/arch/hlt.h +++ b/src/arch/x86/include/arch/hlt.h @@ -3,9 +3,10 @@ #ifndef ARCH_HLT_H #define ARCH_HLT_H -static __always_inline void hlt(void) +static __noreturn __always_inline void hlt(void) { - asm("hlt"); + while (1) + asm("hlt"); } #endif /* ARCH_HLT_H */ -- cgit v1.2.3