]> git.karo-electronics.de Git - linux-beck.git/commitdiff
pch_uart: Fix duplicate memory release issue
authorTomoya MORINAGA <tomoya.rohm@gmail.com>
Mon, 26 Mar 2012 05:43:06 +0000 (14:43 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Apr 2012 19:08:42 +0000 (12:08 -0700)
Add initialize variable to prevent duplicate free memory.

Signed-off-by: Tomoya MORINAGA <tomoya.rohm@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/pch_uart.c

index e7d91d973d52f8e499da8869c3dc17f49b346b29..6e96304b7c8feb436d4c6dbeaac8037266c3c52a 100644 (file)
@@ -656,10 +656,13 @@ static void pch_free_dma(struct uart_port *port)
                dma_release_channel(priv->chan_rx);
                priv->chan_rx = NULL;
        }
-       if (sg_dma_address(&priv->sg_rx))
-               dma_free_coherent(port->dev, port->fifosize,
-                                 sg_virt(&priv->sg_rx),
-                                 sg_dma_address(&priv->sg_rx));
+
+       if (priv->rx_buf_dma) {
+               dma_free_coherent(port->dev, port->fifosize, priv->rx_buf_virt,
+                                 priv->rx_buf_dma);
+               priv->rx_buf_virt = NULL;
+               priv->rx_buf_dma = 0;
+       }
 
        return;
 }