Commit 51518469 authored by Satendra Singh Thakur's avatar Satendra Singh Thakur Committed by Greg Kroah-Hartman

dmaengine: mediatek: hsdma_probe: fixed a memory leak when devm_request_irq fails

[ Upstream commit 1ff95243 ]

When devm_request_irq fails, currently, the function
dma_async_device_unregister gets called. This doesn't free
the resources allocated by of_dma_controller_register.
Therefore, we have called of_dma_controller_free for this purpose.
Signed-off-by: default avatarSatendra Singh Thakur <sst2005@gmail.com>
Link: https://lore.kernel.org/r/20191109113523.6067-1-sst2005@gmail.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent c85bf62a
...@@ -997,7 +997,7 @@ static int mtk_hsdma_probe(struct platform_device *pdev) ...@@ -997,7 +997,7 @@ static int mtk_hsdma_probe(struct platform_device *pdev)
if (err) { if (err) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"request_irq failed with err %d\n", err); "request_irq failed with err %d\n", err);
goto err_unregister; goto err_free;
} }
platform_set_drvdata(pdev, hsdma); platform_set_drvdata(pdev, hsdma);
...@@ -1006,6 +1006,8 @@ static int mtk_hsdma_probe(struct platform_device *pdev) ...@@ -1006,6 +1006,8 @@ static int mtk_hsdma_probe(struct platform_device *pdev)
return 0; return 0;
err_free:
of_dma_controller_free(pdev->dev.of_node);
err_unregister: err_unregister:
dma_async_device_unregister(dd); dma_async_device_unregister(dd);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment