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 <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2021-02-11 03:58:47 -08:00 committed by Anas Nashif
commit 820d828947

View file

@ -1163,7 +1163,7 @@ static void uarte_nrfx_poll_out(const struct device *dev, unsigned char c)
key = irq_lock(); key = irq_lock();
if (is_tx_ready(dev)) { if (is_tx_ready(dev)) {
#if CONFIG_UART_ASYNC_API #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 < 0) {
data->async->tx_amount = data->async->tx_amount =
nrf_uarte_tx_amount_get(uarte); nrf_uarte_tx_amount_get(uarte);