aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/mmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/core/mmc.c')
-rw-r--r--drivers/mmc/core/mmc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 1a889e9c531..cd0c6b246fe 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -499,14 +499,17 @@ static void mmc_resume(struct mmc_host *host)
499 BUG_ON(!host->card); 499 BUG_ON(!host->card);
500 500
501 mmc_claim_host(host); 501 mmc_claim_host(host);
502
503 err = mmc_init_card(host, host->ocr, host->card); 502 err = mmc_init_card(host, host->ocr, host->card);
503 mmc_release_host(host);
504
504 if (err != MMC_ERR_NONE) { 505 if (err != MMC_ERR_NONE) {
505 mmc_remove(host); 506 mmc_remove(host);
507
508 mmc_claim_host(host);
506 mmc_detach_bus(host); 509 mmc_detach_bus(host);
510 mmc_release_host(host);
507 } 511 }
508 512
509 mmc_release_host(host);
510} 513}
511 514
512#else 515#else
@@ -567,14 +570,14 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr)
567 570
568 err = mmc_add_card(host->card); 571 err = mmc_add_card(host->card);
569 if (err) 572 if (err)
570 goto reclaim_host; 573 goto remove_card;
571 574
572 return 0; 575 return 0;
573 576
574reclaim_host: 577remove_card:
575 mmc_claim_host(host);
576 mmc_remove_card(host->card); 578 mmc_remove_card(host->card);
577 host->card = NULL; 579 host->card = NULL;
580 mmc_claim_host(host);
578err: 581err:
579 mmc_detach_bus(host); 582 mmc_detach_bus(host);
580 mmc_release_host(host); 583 mmc_release_host(host);