Skip to content

Commit

Permalink
mmc: skip reclaiming host on mmc_add_card() error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sergei Shtylyov authored and Ulf Hansson committed Oct 26, 2015
1 parent 7f8a9a7 commit 2860d06
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions drivers/mmc/core/mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2004,14 +2004,13 @@ int mmc_attach_mmc(struct mmc_host *host)

mmc_release_host(host);
err = mmc_add_card(host->card);
mmc_claim_host(host);
if (err)
goto remove_card;

mmc_claim_host(host);
return 0;

remove_card:
mmc_release_host(host);
mmc_remove_card(host->card);
mmc_claim_host(host);
host->card = NULL;
Expand Down
3 changes: 1 addition & 2 deletions drivers/mmc/core/sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1243,14 +1243,13 @@ int mmc_attach_sd(struct mmc_host *host)

mmc_release_host(host);
err = mmc_add_card(host->card);
mmc_claim_host(host);
if (err)
goto remove_card;

mmc_claim_host(host);
return 0;

remove_card:
mmc_release_host(host);
mmc_remove_card(host->card);
host->card = NULL;
mmc_claim_host(host);
Expand Down

0 comments on commit 2860d06

Please sign in to comment.