]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
riscv: alternative: Use IS_ENABLED() over ifdeffery for apply_vdso_alternatives()
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>
Mon, 4 May 2026 06:30:51 +0000 (08:30 +0200)
committerPaul Walmsley <pjw@kernel.org>
Sun, 7 Jun 2026 07:55:59 +0000 (01:55 -0600)
IS_ENABLED() allows better compilation coverage while still optimizing
away all the dead code. Also it will make some upcoming changes easier.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Link: https://patch.msgid.link/20260504-riscv-cfi-vdso-alternative-v1-2-bcdf3d37f62e@linutronix.de
Signed-off-by: Paul Walmsley <pjw@kernel.org>
arch/riscv/kernel/alternative.c

index 7642704c7f1841f67fc23738063f22b4ecf58194..59991922a5dca577b7b2e9a4cd79aaa6420e18bc 100644 (file)
@@ -173,7 +173,6 @@ static void __init_or_module _apply_alternatives(struct alt_entry *begin,
                                stage);
 }
 
-#ifdef CONFIG_MMU
 static void __init apply_vdso_alternatives(void)
 {
        const Elf_Ehdr *hdr;
@@ -194,9 +193,6 @@ static void __init apply_vdso_alternatives(void)
                            (struct alt_entry *)end,
                            RISCV_ALTERNATIVES_BOOT);
 }
-#else
-static void __init apply_vdso_alternatives(void) { }
-#endif
 
 void __init apply_boot_alternatives(void)
 {
@@ -207,7 +203,8 @@ void __init apply_boot_alternatives(void)
                            (struct alt_entry *)__alt_end,
                            RISCV_ALTERNATIVES_BOOT);
 
-       apply_vdso_alternatives();
+       if (IS_ENABLED(CONFIG_MMU))
+               apply_vdso_alternatives();
 }
 
 /*