Skip to content

Commit 813fe0b

Browse files
nordic-krchnordic-piks
authored andcommitted
drivers: serial: uart_nrf_sw_lpuart: Fix early TX abort
Fix case when uart_tx_abort is called before actual transfer is started. In that case, internal call to uart_tx_abort was returning -EFAULT and this error was returned to the user. This error is now overwritten to 0 since that is a correct case when TX is aborted during transfer setup. Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 3faeccf commit 813fe0b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/serial/uart_nrf_sw_lpuart.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,10 @@ static int api_tx_abort(const struct device *dev)
713713
irq_unlock(key);
714714

715715
err = uart_tx_abort(data->uart);
716-
if (err != -EFAULT) {
716+
if (err == -EFAULT) {
717+
/* If abort is before TX is started just report ABORT from here. */
718+
err = 0;
719+
} else {
717720
/* if successfully aborted or returned error different than
718721
* one indicating that there is no transfer, return error code.
719722
*/

0 commit comments

Comments
 (0)