Skip to content

Commit

Permalink
drivers: console: uart: Avoid undefined behavior
Browse files Browse the repository at this point in the history
Putting #ifdef inside a macro invocation is undefined behavior.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
  • Loading branch information
rettichschnidi committed Nov 27, 2024
1 parent a6ea01d commit a1554b5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drivers/console/uart_console.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

0 comments on commit a1554b5

Please sign in to comment.