From a1554b5cacd8015a8563a70b1e25e882aab19e88 Mon Sep 17 00:00:00 2001 From: Reto Schneider Date: Wed, 27 Nov 2024 13:30:15 +0100 Subject: [PATCH] drivers: console: uart: Avoid undefined behavior Putting #ifdef inside a macro invocation is undefined behavior. Signed-off-by: Reto Schneider --- drivers/console/uart_console.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/console/uart_console.c b/drivers/console/uart_console.c index 8d776ff7aeed031..0221be4a54e65af 100644 --- a/drivers/console/uart_console.c +++ b/drivers/console/uart_console.c @@ -615,10 +615,8 @@ static int uart_console_init(void) } /* UART console initializes after the UART device itself */ -SYS_INIT(uart_console_init, #if defined(CONFIG_EARLY_CONSOLE) - PRE_KERNEL_1, +SYS_INIT(uart_console_init, PRE_KERNEL_1, CONFIG_CONSOLE_INIT_PRIORITY); #else - POST_KERNEL, -#endif - CONFIG_CONSOLE_INIT_PRIORITY); +SYS_INIT(uart_console_init, POST_KERNEL, CONFIG_CONSOLE_INIT_PRIORITY); +#endif /* CONFIG_EARLY_CONSOLE */