Skip to contentSkip to conversation

mmc: skip reclaiming host on mmc_add_card() error

PATCH Applied Sergei Shtylyov 2 participants 2 messages Oct 14, 2015 – Oct 16, 2015 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 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.

---
The patch is against Ulf Hansson's 'mmc.git' repo's 'next' branch.

 drivers/mmc/core/mmc.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mmc/core/mmc.c +1 -2
Index: mmc/drivers/mmc/core/mmc.c
===================================================================
@@ -2009,14 +2009,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;
Applied
#1 lore raw
Quoted 5 lines · Sergei Shtylyov

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.

Thanks, applied patch 1 and patch 2 (squashed them) for next.

Kind regards
Uffe

Quoted 28 lines

---
The patch is against Ulf Hansson's 'mmc.git' repo's 'next' branch.

 drivers/mmc/core/mmc.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Index: mmc/drivers/mmc/core/mmc.c
===================================================================

drivers/mmc/core/mmc.c +1 -2
@@ -2009,14 +2009,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;