From: Muhammad Hamza Farooq Date: Fri, 18 Sep 2015 11:08:31 +0000 (+0200) Subject: serial: sh-sci: Do not terminate DMA engine when race condition occurs X-Git-Tag: firefly_0821_release~176^2~803^2~98 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3b963042b64f5de3c63a1ebcbe2cad6b1597b8b9;p=firefly-linux-kernel-4.4.55.git serial: sh-sci: Do not terminate DMA engine when race condition occurs When DMA packet completion and timer expiry take place at the same time, do not terminate the DMA engine, leading by submission of new descriptors, as the DMA communication hasn't necessarily stopped here. Signed-off-by: Muhammad Hamza Farooq Signed-off-by: Geert Uytterhoeven Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 84c15152e111..9406fe227bc7 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -1296,9 +1296,14 @@ static void rx_timer_fn(unsigned long arg) } status = dmaengine_tx_status(s->chan_rx, s->active_rx, &state); - if (status == DMA_COMPLETE) + if (status == DMA_COMPLETE) { dev_dbg(port->dev, "Cookie %d #%d has already completed\n", s->active_rx, active); + spin_unlock_irqrestore(&port->lock, flags); + + /* Let packet complete handler take care of the packet */ + return; + } /* Handle incomplete DMA receive */ dmaengine_terminate_all(s->chan_rx);