diff --git a/drivers/console/uart_console.c b/drivers/console/uart_console.c index 4800180b3f8..378bbe91ff3 100644 --- a/drivers/console/uart_console.c +++ b/drivers/console/uart_console.c @@ -446,13 +446,18 @@ static void uart_console_isr(const struct device *unused, void *user_data) ARG_UNUSED(user_data); static uint8_t last_char = '\0'; - while (uart_irq_update(uart_console_dev) && - uart_irq_is_pending(uart_console_dev)) { + while (uart_irq_update(uart_console_dev) > 0 && + uart_irq_is_pending(uart_console_dev) > 0) { static struct console_input *cmd; uint8_t byte; int rx; - if (!uart_irq_rx_ready(uart_console_dev)) { + rx = uart_irq_rx_ready(uart_console_dev); + if (rx < 0) { + return; + } + + if (rx == 0) { continue; } @@ -561,7 +566,7 @@ static void console_input_init(void) uart_irq_callback_set(uart_console_dev, uart_console_isr); /* Drain the fifo */ - while (uart_irq_rx_ready(uart_console_dev)) { + while (uart_irq_rx_ready(uart_console_dev) > 0) { uart_fifo_read(uart_console_dev, &c, 1); }