diff options
author | Tomoya MORINAGA <tomoya.rohm@gmail.com> | 2012-03-26 01:43:06 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-09 15:08:42 -0400 |
commit | ef4f9d4f09265b60fcb6bfa31a614ea84a72b7a8 (patch) | |
tree | 93bb73ecf28c8e1d96900e270b542ddbcab4c9a4 | |
parent | 04e2c2e3bfb1652510d4c12ac2837a8f8b08bd3a (diff) |
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>
-rw-r--r-- | drivers/tty/serial/pch_uart.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index e7d91d973d5..6e96304b7c8 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) | |||
656 | dma_release_channel(priv->chan_rx); | 656 | dma_release_channel(priv->chan_rx); |
657 | priv->chan_rx = NULL; | 657 | priv->chan_rx = NULL; |
658 | } | 658 | } |
659 | if (sg_dma_address(&priv->sg_rx)) | 659 | |
660 | dma_free_coherent(port->dev, port->fifosize, | 660 | if (priv->rx_buf_dma) { |
661 | sg_virt(&priv->sg_rx), | 661 | dma_free_coherent(port->dev, port->fifosize, priv->rx_buf_virt, |
662 | sg_dma_address(&priv->sg_rx)); | 662 | priv->rx_buf_dma); |
663 | priv->rx_buf_virt = NULL; | ||
664 | priv->rx_buf_dma = 0; | ||
665 | } | ||
663 | 666 | ||
664 | return; | 667 | return; |
665 | } | 668 | } |