dma/mediatek-hs/probe: Fixed a memory leak when devm_request_irq fails
Subsystems (3)
PATCH 1/1 dma/mediatek-hs/probe: Fixed a memory leak when devm_request_irq fails
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.
--- drivers/dma/mediatek/mtk-hsdma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/mediatek/mtk-hsdma.c +3 -1
@@ -997,7 +997,7 @@ static int mtk_hsdma_probe(struct platform_device *pdev)if (err) {dev_err (&pdev->dev,"request_irq failed with err %d\n" , err); - goto err_unregister; + goto err_free; }platform_set_drvdata (pdev, hsdma);
@@ -1006,6 +1006,8 @@ static int mtk_hsdma_probe(struct platform_device *pdev)return 0 ; +err_free: +of_dma_controller_free (pdev->dev.of_node); err_unregister:dma_async_device_unregister (dd);
Signature · 1 line
2.17.1
Vinod Koul
maintainerQuoted 4 lines · Satendra Singh Thakur
When
devm_request_irqfails, currently, the functiondma_async_device_unregistergets called. This doesn't free the resources allocated byof_dma_controller_register. Therefore, we have calledof_dma_controller_freefor this purpose.
Please revise this one as well!
Quoted 30 lines
Signed-off-by Satendra Singh Thakur <[email protected]>--- drivers/dma/mediatek/mtk-hsdma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/dma/mediatek/mtk-hsdma.c +3
-1@@ -997,7 +997,7 @@ static int mtk_hsdma_probe(struct platform_device *pdev)if (err) {dev_err (&pdev->dev,"request_irq failed with err %d\n" , err); - goto err_unregister; + goto err_free; }platform_set_drvdata (pdev, hsdma);@@ -1006,6 +1006,8 @@ static int mtk_hsdma_probe(struct platform_device *pdev)return 0 ; +err_free: +of_dma_controller_free (pdev->dev.of_node); err_unregister:dma_async_device_unregister (dd);Signature · 1 line
2.17.1
Signature · 1 line
~Vinod
PATCH 1/1 dmaengine: mediatek: hsdma_probe: fixed a memory leak when devm_request_irq fails
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.
---
v1: modified the subject line with new tags
drivers/dma/mediatek/mtk-hsdma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/dma/mediatek/mtk-hsdma.c +3 -1
@@ -997,7 +997,7 @@ static int mtk_hsdma_probe(struct platform_device *pdev)if (err) {dev_err (&pdev->dev,"request_irq failed with err %d\n" , err); - goto err_unregister; + goto err_free; }platform_set_drvdata (pdev, hsdma);
@@ -1006,6 +1006,8 @@ static int mtk_hsdma_probe(struct platform_device *pdev)return 0 ; +err_free: +of_dma_controller_free (pdev->dev.of_node); err_unregister:dma_async_device_unregister (dd);
Signature · 1 line
2.17.1
Vinod Koul
maintainerRe: [PATCH v1] dmaengine: mediatek: hsdma_probe: fixed a memory leak when devm_request_irq fails
Hi Satendra,
Quoted 4 lines · Satendra Singh Thakur
When
devm_request_irqfails, currently, the functiondma_async_device_unregistergets called. This doesn't free the resources allocated byof_dma_controller_register. Therefore, we have calledof_dma_controller_freefor this purpose.
This should have been a v2! Anyway I have applied this and other patch
Thanks
Signature · 1 line
~Vinod