aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/pch_uart.c
diff options
context:
space:
mode:
authorTomoya MORINAGA <tomoya.rohm@gmail.com>2012-03-26 14:43:06 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-09 12:08:42 -0700
commitef4f9d4f09265b60fcb6bfa31a614ea84a72b7a8 (patch)
tree93bb73ecf28c8e1d96900e270b542ddbcab4c9a4 /drivers/tty/serial/pch_uart.c
parentpch_uart: Fix return value issue (diff)
downloadlinux-dev-ef4f9d4f09265b60fcb6bfa31a614ea84a72b7a8.tar.xz
linux-dev-ef4f9d4f09265b60fcb6bfa31a614ea84a72b7a8.zip
pch_uart: Fix duplicate memory release issue
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>
Diffstat (limited to 'drivers/tty/serial/pch_uart.c')
-rw-r--r--drivers/tty/serial/pch_uart.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index e7d91d973d52..6e96304b7c8f 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -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;
}