Skip to content

Commit d704b2d

Browse files
Aaron Bricegregkh
authored andcommitted
tty: serial: fsl_lpuart: Fix Tx DMA edge case
In the case where head == 0 on the circular buffer, there should be one DMA buffer, not two. The second zero-length buffer would break the lpuart driver, transfer would never complete. Signed-off-by: Aaron Brice <[email protected]> Acked-by: Stefan Agner <[email protected]> Tested-by: Stefan Agner <[email protected]> Tested-by: Bhuvanchandra DV <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f00a7c5 commit d704b2d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/tty/serial/fsl_lpuart.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static void lpuart_dma_tx(struct lpuart_port *sport)
328328

329329
sport->dma_tx_bytes = uart_circ_chars_pending(xmit);
330330

331-
if (xmit->tail < xmit->head) {
331+
if (xmit->tail < xmit->head || xmit->head == 0) {
332332
sport->dma_tx_nents = 1;
333333
sg_init_one(sgl, xmit->buf + xmit->tail, sport->dma_tx_bytes);
334334
} else {
@@ -359,7 +359,6 @@ static void lpuart_dma_tx(struct lpuart_port *sport)
359359
sport->dma_tx_in_progress = true;
360360
sport->dma_tx_cookie = dmaengine_submit(sport->dma_tx_desc);
361361
dma_async_issue_pending(sport->dma_tx_chan);
362-
363362
}
364363

365364
static void lpuart_dma_tx_complete(void *arg)

0 commit comments

Comments
 (0)