From bf19820e260d117708337f4cc23b708d39026d5f Mon Sep 17 00:00:00 2001 From: Krzysztof Chruscinski Date: Thu, 11 Feb 2021 03:58:47 -0800 Subject: [PATCH] [nrf fromtree] drivers: serial: nrfx_uarte: Add missing check If statement was unconditionally reading a field from async struct while pointer to this struct may be null if asynchronous API is enabled but given driver instance is not using it. Signed-off-by: Krzysztof Chruscinski --- drivers/serial/uart_nrfx_uarte.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/serial/uart_nrfx_uarte.c b/drivers/serial/uart_nrfx_uarte.c index 18713e2e1d4..22fde106306 100644 --- a/drivers/serial/uart_nrfx_uarte.c +++ b/drivers/serial/uart_nrfx_uarte.c @@ -1163,7 +1163,7 @@ static void uarte_nrfx_poll_out(const struct device *dev, unsigned char c) key = irq_lock(); if (is_tx_ready(dev)) { #if CONFIG_UART_ASYNC_API - if (data->async->tx_size && + if (data->async && data->async->tx_size && data->async->tx_amount < 0) { data->async->tx_amount = nrf_uarte_tx_amount_get(uarte);