Skip to content

Commit 9628ecd

Browse files
ananglstephanosio
authored andcommitted
drivers: uart_nrfx_uarte: Fix call to HW_RX_COUNTING_ENABLED()
Since the macro references `data->async->hw_rx_counting`, it cannot be called when `data->async` is NULL, and this could happen when the PM_DEVICE_ACTION_RESUME action was requested for an instance that uses the interrupt-driven API while for another instance that uses the asynchronous API the hardware counting of bytes was configured. Prevent this by calling the macro from a proper `if` block. Signed-off-by: Andrzej Głąbek <[email protected]>
1 parent 676441e commit 9628ecd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/serial/uart_nrfx_uarte.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,10 +1956,11 @@ static int uarte_nrfx_pm_action(const struct device *dev,
19561956
nrf_uarte_enable(uarte);
19571957

19581958
#ifdef UARTE_ANY_ASYNC
1959-
if (HW_RX_COUNTING_ENABLED(data)) {
1960-
nrfx_timer_enable(&cfg->timer);
1961-
}
19621959
if (data->async) {
1960+
if (HW_RX_COUNTING_ENABLED(data)) {
1961+
nrfx_timer_enable(&cfg->timer);
1962+
}
1963+
19631964
return 0;
19641965
}
19651966
#endif

0 commit comments

Comments
 (0)