Skip to content

Commit 1ac676d

Browse files
drivers: console: uart: Avoid undefined behavior
Putting #ifdef inside a macro invocation is undefined behavior. Signed-off-by: Reto Schneider <[email protected]>
1 parent af537c7 commit 1ac676d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

drivers/console/uart_console.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -615,10 +615,8 @@ static int uart_console_init(void)
615615
}
616616

617617
/* UART console initializes after the UART device itself */
618-
SYS_INIT(uart_console_init,
619618
#if defined(CONFIG_EARLY_CONSOLE)
620-
PRE_KERNEL_1,
619+
SYS_INIT(uart_console_init, PRE_KERNEL_1, CONFIG_CONSOLE_INIT_PRIORITY);
621620
#else
622-
POST_KERNEL,
623-
#endif
624-
CONFIG_CONSOLE_INIT_PRIORITY);
621+
SYS_INIT(uart_console_init, POST_KERNEL, CONFIG_CONSOLE_INIT_PRIORITY);
622+
#endif /* CONFIG_EARLY_CONSOLE */

0 commit comments

Comments
 (0)