[PATCH] s390/nmi: Annotate s390_handle_damage with __noreturn

Thorsten Blum posted 1 patch 3 months, 1 week ago
arch/s390/kernel/nmi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] s390/nmi: Annotate s390_handle_damage with __noreturn
Posted by Thorsten Blum 3 months, 1 week ago
s390_handle_damage() ends by calling the non-returning function
disabled_wait() and therefore also never returns. Annotate it with the
__noreturn compiler attribute to improve compiler optimizations.

Remove the unreachable infinite while loop.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/s390/kernel/nmi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/s390/kernel/nmi.c b/arch/s390/kernel/nmi.c
index 11f33243a23f..a55abbf65333 100644
--- a/arch/s390/kernel/nmi.c
+++ b/arch/s390/kernel/nmi.c
@@ -184,7 +184,7 @@ static notrace void nmi_print_info(void)
 	sclp_emergency_printk(message);
 }
 
-static notrace void s390_handle_damage(void)
+static notrace void __noreturn s390_handle_damage(void)
 {
 	struct lowcore *lc = get_lowcore();
 	union ctlreg0 cr0, cr0_new;
@@ -214,7 +214,6 @@ static notrace void s390_handle_damage(void)
 	lc->mcck_new_psw = psw_save;
 	local_ctl_load(0, &cr0.reg);
 	disabled_wait();
-	while (1);
 }
 NOKPROBE_SYMBOL(s390_handle_damage);
 
-- 
2.51.0
Re: [PATCH] s390/nmi: Annotate s390_handle_damage with __noreturn
Posted by Heiko Carstens 3 months, 1 week ago
On Mon, Oct 27, 2025 at 09:47:25AM +0100, Thorsten Blum wrote:
> s390_handle_damage() ends by calling the non-returning function
> disabled_wait() and therefore also never returns. Annotate it with the
> __noreturn compiler attribute to improve compiler optimizations.
> 
> Remove the unreachable infinite while loop.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  arch/s390/kernel/nmi.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Applied, thanks.