aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPramod Gurav <pramod.gurav@smartplayin.com>2014-09-23 06:20:06 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2014-09-24 04:39:35 -0400
commit528bc7808f4e36a330ec17ef22803f1345091494 (patch)
tree884e9e93908ab2daf7c46cb1c2f5bff09257bede
parent7bca646e0fc34b19cd84e14ed474d1c95830cc80 (diff)
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: Pramod Gurav <pramod.gurav@smartplayin.com> Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-rw-r--r--drivers/mmc/host/atmel-mci.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
index f32a51ee0fe3..772ef5b0e4d5 100644
--- a/drivers/mmc/host/atmel-mci.c
+++ b/drivers/mmc/host/atmel-mci.c
@@ -2377,7 +2377,7 @@ static int __init atmci_probe(struct platform_device *pdev)
2377 struct resource *regs; 2377 struct resource *regs;
2378 unsigned int nr_slots; 2378 unsigned int nr_slots;
2379 int irq; 2379 int irq;
2380 int ret; 2380 int ret, i;
2381 2381
2382 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2382 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2383 if (!regs) 2383 if (!regs)
@@ -2483,7 +2483,7 @@ static int __init atmci_probe(struct platform_device *pdev)
2483 if (!host->buffer) { 2483 if (!host->buffer) {
2484 ret = -ENOMEM; 2484 ret = -ENOMEM;
2485 dev_err(&pdev->dev, "buffer allocation failed\n"); 2485 dev_err(&pdev->dev, "buffer allocation failed\n");
2486 goto err_init_slot; 2486 goto err_dma_alloc;
2487 } 2487 }
2488 } 2488 }
2489 2489
@@ -2493,7 +2493,13 @@ static int __init atmci_probe(struct platform_device *pdev)
2493 2493
2494 return 0; 2494 return 0;
2495 2495
2496err_dma_alloc:
2497 for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) {
2498 if (host->slot[i])
2499 atmci_cleanup_slot(host->slot[i], i);
2500 }
2496err_init_slot: 2501err_init_slot:
2502 del_timer_sync(&host->timer);
2497 if (host->dma.chan) 2503 if (host->dma.chan)
2498 dma_release_channel(host->dma.chan); 2504 dma_release_channel(host->dma.chan);
2499 free_irq(irq, host); 2505 free_irq(irq, host);
@@ -2520,6 +2526,7 @@ static int __exit atmci_remove(struct platform_device *pdev)
2520 atmci_readl(host, ATMCI_SR); 2526 atmci_readl(host, ATMCI_SR);
2521 clk_disable_unprepare(host->mck); 2527 clk_disable_unprepare(host->mck);
2522 2528
2529 del_timer_sync(&host->timer);
2523 if (host->dma.chan) 2530 if (host->dma.chan)
2524 dma_release_channel(host->dma.chan); 2531 dma_release_channel(host->dma.chan);
2525 2532