diff options
author | Pramod Gurav <pramod.gurav@smartplayin.com> | 2014-09-23 14:20:06 +0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2014-09-24 12:39:35 +0400 |
commit | 528bc7808f4e36a330ec17ef22803f1345091494 (patch) | |
tree | 884e9e93908ab2daf7c46cb1c2f5bff09257bede /drivers/mmc | |
parent | 7bca646e0fc34b19cd84e14ed474d1c95830cc80 (diff) | |
download | linux-528bc7808f4e36a330ec17ef22803f1345091494.tar.xz |
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>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/atmel-mci.c | 11 |
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) struct resource *regs; unsigned int nr_slots; int irq; - int ret; + int ret, i; regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!regs) @@ -2483,7 +2483,7 @@ static int __init atmci_probe(struct platform_device *pdev) if (!host->buffer) { ret = -ENOMEM; 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) 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: + del_timer_sync(&host->timer); if (host->dma.chan) dma_release_channel(host->dma.chan); free_irq(irq, host); @@ -2520,6 +2526,7 @@ static int __exit atmci_remove(struct platform_device *pdev) atmci_readl(host, ATMCI_SR); clk_disable_unprepare(host->mck); + del_timer_sync(&host->timer); if (host->dma.chan) dma_release_channel(host->dma.chan); |