serial: sh-sci: Remove timer on shutdown of port
authorAleksandar Mitev <amitev@visteon.com>
Fri, 18 Sep 2015 11:08:28 +0000 (13:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Oct 2015 16:36:10 +0000 (17:36 +0100)
This prevents DMA timer timeout that can trigger after the port has
been closed.

Signed-off-by: Aleksandar Mitev <amitev@visteon.com>
[geert: Move del_timer_sync() outside spinlock to avoid circular locking
        dependency between rx_timer_fn() and del_timer_sync()]
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 ac9ce8f1ff799a4883f1f642090c5ea1239b5155..36a11110acf4cab5eef643970ed9a4e619f0de65 100644 (file)
@@ -1810,6 +1810,14 @@ static void sci_shutdown(struct uart_port *port)
        sci_stop_tx(port);
        spin_unlock_irqrestore(&port->lock, flags);
 
+#ifdef CONFIG_SERIAL_SH_SCI_DMA
+       if (s->chan_rx) {
+               dev_dbg(port->dev, "%s(%d) deleting rx_timer\n", __func__,
+                       port->line);
+               del_timer_sync(&s->rx_timer);
+       }
+#endif
+
        sci_free_dma(port);
        sci_free_irq(s);
 }