LKML Archive on
help / color / mirror / Atom feed
From: Sherry Sun <>
Subject: [PATCH] tty: serial: fsl_lpuart: check dma_tx_in_progress in tx dma callback
Date: Tue, 17 Aug 2021 18:02:03 +0800	[thread overview]
Message-ID: <> (raw)

From: Fugang Duan <>

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 <>
Signed-off-by: Vipul Kumar <>
Signed-off-by: Sherry Sun <>
 drivers/tty/serial/fsl_lpuart.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index 460e428b7592..117e011aff5f 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -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,

                 reply	other threads:[~2021-08-17 10:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \
    --subject='Re: [PATCH] tty: serial: fsl_lpuart: check dma_tx_in_progress in tx dma callback' \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).