]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mmc: skip reclaiming host on mmc_add_card() error
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Wed, 14 Oct 2015 20:53:03 +0000 (23:53 +0300)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 26 Oct 2015 15:00:14 +0000 (16:00 +0100)
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>
drivers/mmc/core/mmc.c
drivers/mmc/core/sd.c

index 479b84a00bd727b69a91762c686ab8fec4039e87..c793fda27321da0086bb01d92e33d9aa44480ed0 100644 (file)
@@ -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;
index b1b9200a4715bb9f4dbfb8e532756e742e912ce0..141eaa923e18eecc140039d34604d5f2969c023b 100644 (file)
@@ -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);