Skip to content

Commit 93b389f

Browse files
ananglrlubos
authored andcommitted
[nrf fromtree] drivers: uart_nrfx_uarte: Fix call to HW_RX_COUNTING_E...
NABLED() 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]> (cherry picked from commit 9628ecd) Signed-off-by: Pavel Vasilyev <[email protected]>
1 parent db187bb commit 93b389f

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
@@ -1955,10 +1955,11 @@ static int uarte_nrfx_pm_action(const struct device *dev,
19551955
nrf_uarte_enable(uarte);
19561956

19571957
#ifdef UARTE_ANY_ASYNC
1958-
if (HW_RX_COUNTING_ENABLED(data)) {
1959-
nrfx_timer_enable(&cfg->timer);
1960-
}
19611958
if (data->async) {
1959+
if (HW_RX_COUNTING_ENABLED(data)) {
1960+
nrfx_timer_enable(&cfg->timer);
1961+
}
1962+
19621963
return 0;
19631964
}
19641965
#endif

0 commit comments

Comments
 (0)