Skip to content

Commit

Permalink
tty: serial: fsl_lpuart: check dma_tx_in_progress in tx dma callback
Browse files Browse the repository at this point in the history
There have a corner case that tx DMA .callback() is coming after
.flush_buffer(), then .callback() should check dma_tx_in_progress
flag and return in directly.

Signed-off-by: Fugang Duan <[email protected]>
Signed-off-by: Vipul Kumar <[email protected]>
Signed-off-by: Sherry Sun <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
fugangduan authored and gregkh committed Aug 18, 2021
1 parent 1143637 commit 88c1d24
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/tty/serial/fsl_lpuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,10 @@ static void lpuart_dma_tx_complete(void *arg)
unsigned long flags;

spin_lock_irqsave(&sport->port.lock, flags);
if (!sport->dma_tx_in_progress) {
spin_unlock_irqrestore(&sport->port.lock, flags);
return;
}

dma_unmap_sg(chan->device->dev, sgl, sport->dma_tx_nents,
DMA_TO_DEVICE);
Expand Down

0 comments on commit 88c1d24

Please sign in to comment.