[PATCH 1/1] dmaengine:jz4740:fix memory leak

From: Xidong Wang
Date: Tue Apr 03 2018 - 23:22:28 EST


In function jz4740_dma_probe(), the memory allocated by
clk_get() is not released on the error path that ret, which holds
the return value of dma_async_device_register(), is not NULL.
This will result in a memory leak bug.

Signed-off-by: Xidong Wang <wangxidong_97@xxxxxxx>
---
drivers/dma/dma-jz4740.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/dma/dma-jz4740.c b/drivers/dma/dma-jz4740.c
index afd5e10..082c158 100644
--- a/drivers/dma/dma-jz4740.c
+++ b/drivers/dma/dma-jz4740.c
@@ -570,6 +570,7 @@ static int jz4740_dma_probe(struct platform_device *pdev)
dma_async_device_unregister(dd);
err_clk:
clk_disable_unprepare(dmadev->clk);
+ clk_put(dmadev->clk);
return ret;
}

--
2.7.4