mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
mmc: owl-mmc: Fix a resource leak in an error handling path and in the remove function
'dma_request_chan()' calls should be balanced by a corresponding
'dma_release_channel()' call.
Add the missing call both in the error handling path of the probe function
and in the remove function.
Fixes: ff65ffe46d
("mmc: Add Actions Semi Owl SoCs SD/MMC driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/20201209194202.54099-1-christophe.jaillet@wanadoo.fr
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
committed by
Ulf Hansson
parent
0bb7e560f8
commit
5d15cbf635
@@ -640,7 +640,7 @@ static int owl_mmc_probe(struct platform_device *pdev)
|
|||||||
owl_host->irq = platform_get_irq(pdev, 0);
|
owl_host->irq = platform_get_irq(pdev, 0);
|
||||||
if (owl_host->irq < 0) {
|
if (owl_host->irq < 0) {
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto err_free_host;
|
goto err_release_channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = devm_request_irq(&pdev->dev, owl_host->irq, owl_irq_handler,
|
ret = devm_request_irq(&pdev->dev, owl_host->irq, owl_irq_handler,
|
||||||
@@ -648,19 +648,21 @@ static int owl_mmc_probe(struct platform_device *pdev)
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "Failed to request irq %d\n",
|
dev_err(&pdev->dev, "Failed to request irq %d\n",
|
||||||
owl_host->irq);
|
owl_host->irq);
|
||||||
goto err_free_host;
|
goto err_release_channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = mmc_add_host(mmc);
|
ret = mmc_add_host(mmc);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "Failed to add host\n");
|
dev_err(&pdev->dev, "Failed to add host\n");
|
||||||
goto err_free_host;
|
goto err_release_channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_dbg(&pdev->dev, "Owl MMC Controller Initialized\n");
|
dev_dbg(&pdev->dev, "Owl MMC Controller Initialized\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_release_channel:
|
||||||
|
dma_release_channel(owl_host->dma);
|
||||||
err_free_host:
|
err_free_host:
|
||||||
mmc_free_host(mmc);
|
mmc_free_host(mmc);
|
||||||
|
|
||||||
@@ -674,6 +676,7 @@ static int owl_mmc_remove(struct platform_device *pdev)
|
|||||||
|
|
||||||
mmc_remove_host(mmc);
|
mmc_remove_host(mmc);
|
||||||
disable_irq(owl_host->irq);
|
disable_irq(owl_host->irq);
|
||||||
|
dma_release_channel(owl_host->dma);
|
||||||
mmc_free_host(mmc);
|
mmc_free_host(mmc);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user