Skip to content

Commit ccf07d4

Browse files
ABESTMkartben
authored andcommitted
driver: uart: stm32: Clear buffer length only in UART TC event
The buffer_length != 0 is used to check if there is transfer ongoing inside the uart_stm32_async_tx function. uart_stm32_dma_tx_cb clears it to 0 when TX DMA is finished, but before the USART send all the data from shift register. buffer_length is also cleared in callback async_evt_tx_done, which is called when USART finished sending all the bytes. If the uart_stm32_async_tx would be called after uart_stm32_async_tx, but before async_evt_tx_done there could be race condition on buffer_length. Signed-off-by: Adam BERLINGER <adam.berlinger@st.com>
1 parent 56446ff commit ccf07d4

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

drivers/serial/uart_stm32.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,8 +1532,6 @@ void uart_stm32_dma_tx_cb(const struct device *dma_dev, void *user_data,
15321532
stat.pending_length;
15331533
}
15341534

1535-
data->dma_tx.buffer_length = 0;
1536-
15371535
irq_unlock(key);
15381536
}
15391537

0 commit comments

Comments
 (0)