diff options
author | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> | 2015-10-14 16:53:03 -0400 |
---|---|---|
committer | Ulf Hansson <ulf.hansson@linaro.org> | 2015-10-26 11:00:14 -0400 |
commit | 2860d060ac902df0164cc9580f843b101e27a2c6 (patch) | |
tree | 43e730efdee8406e8105b43743523af41849cd01 /drivers | |
parent | 7f8a9a7e98f99e9cd874eaf6ca2f00438c2a7c38 (diff) |
mmc: skip reclaiming host on mmc_add_card() error
There's little sense in releasing the host on mmc_add_card() error
immediately after reclaiming it, so reclaim the host only in case
of success.
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mmc/core/mmc.c | 3 | ||||
-rw-r--r-- | drivers/mmc/core/sd.c | 3 |
2 files changed, 2 insertions, 4 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 479b84a00bd7..c793fda27321 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -2004,14 +2004,13 @@ int mmc_attach_mmc(struct mmc_host *host) | |||
2004 | 2004 | ||
2005 | mmc_release_host(host); | 2005 | mmc_release_host(host); |
2006 | err = mmc_add_card(host->card); | 2006 | err = mmc_add_card(host->card); |
2007 | mmc_claim_host(host); | ||
2008 | if (err) | 2007 | if (err) |
2009 | goto remove_card; | 2008 | goto remove_card; |
2010 | 2009 | ||
2010 | mmc_claim_host(host); | ||
2011 | return 0; | 2011 | return 0; |
2012 | 2012 | ||
2013 | remove_card: | 2013 | remove_card: |
2014 | mmc_release_host(host); | ||
2015 | mmc_remove_card(host->card); | 2014 | mmc_remove_card(host->card); |
2016 | mmc_claim_host(host); | 2015 | mmc_claim_host(host); |
2017 | host->card = NULL; | 2016 | host->card = NULL; |
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index b1b9200a4715..141eaa923e18 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c | |||
@@ -1243,14 +1243,13 @@ int mmc_attach_sd(struct mmc_host *host) | |||
1243 | 1243 | ||
1244 | mmc_release_host(host); | 1244 | mmc_release_host(host); |
1245 | err = mmc_add_card(host->card); | 1245 | err = mmc_add_card(host->card); |
1246 | mmc_claim_host(host); | ||
1247 | if (err) | 1246 | if (err) |
1248 | goto remove_card; | 1247 | goto remove_card; |
1249 | 1248 | ||
1249 | mmc_claim_host(host); | ||
1250 | return 0; | 1250 | return 0; |
1251 | 1251 | ||
1252 | remove_card: | 1252 | remove_card: |
1253 | mmc_release_host(host); | ||
1254 | mmc_remove_card(host->card); | 1253 | mmc_remove_card(host->card); |
1255 | host->card = NULL; | 1254 | host->card = NULL; |
1256 | mmc_claim_host(host); | 1255 | mmc_claim_host(host); |