summaryrefslogtreecommitdiff
path: root/drivers/tty/serial/imx.c
diff options
context:
space:
mode:
authorFugang Duan <b38611@freescale.com>2015-11-11 09:31:04 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:26:02 +0800
commit8e80ee77c7e952e96710316ae3525a99986fed2a (patch)
tree34505207f29a9d53e3c35354ff0bb4b14696cea5 /drivers/tty/serial/imx.c
parentaa91843b7aa5f32f4b2a69777de888772050e932 (diff)
MLK-11851 tty: series: imx: add dma memory check before freeing
Add dma memory check before free it. Signed-off-by: Fugang Duan <B38611@freescale.com>
Diffstat (limited to 'drivers/tty/serial/imx.c')
-rw-r--r--drivers/tty/serial/imx.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index b2ca614e21bf..41aa463bee8a 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -1127,10 +1127,12 @@ static void imx_uart_dma_exit(struct imx_port *sport)
dma_release_channel(sport->dma_chan_rx);
sport->dma_chan_rx = NULL;
- dma_free_coherent(NULL, IMX_RXBD_NUM * RX_BUF_SIZE,
- (void *)sport->rx_buf.buf,
- sport->rx_buf.dmaaddr);
- sport->rx_buf.buf = NULL;
+ if (sport->rx_buf.buf) {
+ dma_free_coherent(NULL, IMX_RXBD_NUM * RX_BUF_SIZE,
+ (void *)sport->rx_buf.buf,
+ sport->rx_buf.dmaaddr);
+ sport->rx_buf.buf = NULL;
+ }
}
if (sport->dma_chan_tx) {