serial: sh-sci: Don't call sci_dma_rx_push() if no data has arrived
authorGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 21 Aug 2015 18:02:57 +0000 (20:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Oct 2015 16:33:48 +0000 (17:33 +0100)
On receive DMA time-out, avoid calling sci_dma_rx_push() if no data was
transferred by the timed out DMA request.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sh-sci.c

index ffcbf6eaf5f98723a3bc456408e7660a2599c64b..d8b73e791a554823f942893453c0c9b6c8b9ae87 100644 (file)
@@ -1467,10 +1467,11 @@ static void work_fn_rx(struct work_struct *work)
                dev_dbg(port->dev, "Read %u bytes with cookie %d\n", read,
                        s->active_rx);
 
-               count = sci_dma_rx_push(s, s->rx_buf[new], read);
-
-               if (count)
-                       tty_flip_buffer_push(&port->state->port);
+               if (read) {
+                       count = sci_dma_rx_push(s, s->rx_buf[new], read);
+                       if (count)
+                               tty_flip_buffer_push(&port->state->port);
+               }
 
                spin_unlock_irqrestore(&port->lock, flags);