summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorGao Pan <pandy.gao@nxp.com>2016-01-08 08:33:15 +0300
committerWolfram Sang <wsa@the-dreams.de>2016-01-10 12:10:28 +0300
commitc55281531282930de0aace46b2d6b22653937818 (patch)
tree5c4acab372f83ec5e1312726e949316b9a8b16e0 /drivers/i2c
parenta570a27af4d781619dfb5139f3b760e964373c29 (diff)
downloadlinux-c55281531282930de0aace46b2d6b22653937818.tar.xz
i2c: imx: fix i2c resource leak with dma transfer
In i2c_imx_dma_xfer(), when dmaengine_submit() returns error, the context goto label err_submit and then return. However, the memory allocated for txdesc has not been freed yet, which leads to resource leak. Signed-off-by: Gao Pan <b54642@freescale.com> Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-imx.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 8b68dbf4786c..a2b132cef717 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -387,6 +387,7 @@ static int i2c_imx_dma_xfer(struct imx_i2c_struct *i2c_imx,
return 0;
err_submit:
+ dmaengine_terminate_all(dma->chan_using);
err_desc:
dma_unmap_single(chan_dev, dma->dma_buf,
dma->dma_len, dma->dma_data_dir);