Commit 528bc780 authored by Pramod Gurav's avatar Pramod Gurav Committed by Ulf Hansson

mmc: atmel-mci: Release mmc resources on failure in probe

This change takes care of releasing mmc resources on error cases in
probe function which was missing. Also release timer in remove function.
Signed-off-by: default avatarPramod Gurav <pramod.gurav@smartplayin.com>
Acked-by: default avatarLudovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 7bca646e
...@@ -2377,7 +2377,7 @@ static int __init atmci_probe(struct platform_device *pdev) ...@@ -2377,7 +2377,7 @@ static int __init atmci_probe(struct platform_device *pdev)
struct resource *regs; struct resource *regs;
unsigned int nr_slots; unsigned int nr_slots;
int irq; int irq;
int ret; int ret, i;
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!regs) if (!regs)
...@@ -2483,7 +2483,7 @@ static int __init atmci_probe(struct platform_device *pdev) ...@@ -2483,7 +2483,7 @@ static int __init atmci_probe(struct platform_device *pdev)
if (!host->buffer) { if (!host->buffer) {
ret = -ENOMEM; ret = -ENOMEM;
dev_err(&pdev->dev, "buffer allocation failed\n"); dev_err(&pdev->dev, "buffer allocation failed\n");
goto err_init_slot; goto err_dma_alloc;
} }
} }
...@@ -2493,7 +2493,13 @@ static int __init atmci_probe(struct platform_device *pdev) ...@@ -2493,7 +2493,13 @@ static int __init atmci_probe(struct platform_device *pdev)
return 0; return 0;
err_dma_alloc:
for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) {
if (host->slot[i])
atmci_cleanup_slot(host->slot[i], i);
}
err_init_slot: err_init_slot:
del_timer_sync(&host->timer);
if (host->dma.chan) if (host->dma.chan)
dma_release_channel(host->dma.chan); dma_release_channel(host->dma.chan);
free_irq(irq, host); free_irq(irq, host);
...@@ -2520,6 +2526,7 @@ static int __exit atmci_remove(struct platform_device *pdev) ...@@ -2520,6 +2526,7 @@ static int __exit atmci_remove(struct platform_device *pdev)
atmci_readl(host, ATMCI_SR); atmci_readl(host, ATMCI_SR);
clk_disable_unprepare(host->mck); clk_disable_unprepare(host->mck);
del_timer_sync(&host->timer);
if (host->dma.chan) if (host->dma.chan)
dma_release_channel(host->dma.chan); dma_release_channel(host->dma.chan);
......
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