drivers: serial: nrf_uarte: Add missing check for async API

uarte_enable function was not supporting a case when async
api was enabled but instance did not use it. Added runtime
check for async instance presence.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2021-05-10 14:57:42 +02:00 committed by Carles Cufí
commit 1ddfea32bf

View file

@ -514,6 +514,8 @@ static void uarte_enable(const struct device *dev, uint32_t mask)
{
#ifdef CONFIG_UART_ASYNC_API
struct uarte_nrfx_data *data = get_dev_data(dev);
if (data->async) {
bool disabled = data->async->low_power_mask == 0;
data->async->low_power_mask |= mask;
@ -526,6 +528,7 @@ static void uarte_enable(const struct device *dev, uint32_t mask)
nrfx_timer_increment(timer);
}
}
}
#endif
nrf_uarte_enable(get_uarte_instance(dev));
}