diff --git a/drivers/serial/uart_esp32.c b/drivers/serial/uart_esp32.c index 2adcc66b672..6e03121a99c 100644 --- a/drivers/serial/uart_esp32.c +++ b/drivers/serial/uart_esp32.c @@ -103,7 +103,8 @@ static int uart_esp32_poll_in(const struct device *dev, unsigned char *p_char) } uart_hal_read_rxfifo(&DEV_CFG(dev)->hal, p_char, &inout_rd_len); - return inout_rd_len; + + return 0; } static void uart_esp32_poll_out(const struct device *dev, unsigned char c) @@ -355,6 +356,10 @@ static int uart_esp32_fifo_fill(const struct device *dev, { uint32_t written = 0; + if (len < 0) { + return 0; + } + uart_hal_write_txfifo(&DEV_CFG(dev)->hal, tx_data, len, &written); return written; }