aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/mmc.c13
-rw-r--r--drivers/mmc/core/sd.c13
2 files changed, 16 insertions, 10 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 1a889e9c5316..cd0c6b246fed 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);
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index df3bbfea2269..0b478de48acc 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -573,14 +573,17 @@ static void mmc_sd_resume(struct mmc_host *host)
573 BUG_ON(!host->card); 573 BUG_ON(!host->card);
574 574
575 mmc_claim_host(host); 575 mmc_claim_host(host);
576
577 err = mmc_sd_init_card(host, host->ocr, host->card); 576 err = mmc_sd_init_card(host, host->ocr, host->card);
577 mmc_release_host(host);
578
578 if (err != MMC_ERR_NONE) { 579 if (err != MMC_ERR_NONE) {
579 mmc_sd_remove(host); 580 mmc_sd_remove(host);
581
582 mmc_claim_host(host);
580 mmc_detach_bus(host); 583 mmc_detach_bus(host);
584 mmc_release_host(host);
581 } 585 }
582 586
583 mmc_release_host(host);
584} 587}
585 588
586#else 589#else
@@ -648,14 +651,14 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr)
648 651
649 err = mmc_add_card(host->card); 652 err = mmc_add_card(host->card);
650 if (err) 653 if (err)
651 goto reclaim_host; 654 goto remove_card;
652 655
653 return 0; 656 return 0;
654 657
655reclaim_host: 658remove_card:
656 mmc_claim_host(host);
657 mmc_remove_card(host->card); 659 mmc_remove_card(host->card);
658 host->card = NULL; 660 host->card = NULL;
661 mmc_claim_host(host);
659err: 662err:
660 mmc_detach_bus(host); 663 mmc_detach_bus(host);
661 mmc_release_host(host); 664 mmc_release_host(host);