]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
mmc: mmc_getcd/getwp: use sensible defaults
authorPeter Korsgaard <peter.korsgaard@barco.com>
Thu, 21 Mar 2013 04:00:03 +0000 (04:00 +0000)
committerTom Rini <trini@ti.com>
Sun, 24 Mar 2013 16:49:12 +0000 (12:49 -0400)
Let mmc_getcd() return true and mmc_getwp() false if mmc driver doesn't
provide handlers for them.

Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
[trini: Add braces around first if test in each case to fix warning]
Signed-off-by: Tom Rini <trini@ti.com>
drivers/mmc/mmc.c

index 7b5fdd9f66ed51445c2588b33a1e6c4ad0961b6f..d732581eb8d9708d6c30019d5f376b9beaea29b2 100644 (file)
@@ -51,8 +51,12 @@ int mmc_getwp(struct mmc *mmc)
 
        wp = board_mmc_getwp(mmc);
 
-       if ((wp < 0) && mmc->getwp)
-               wp = mmc->getwp(mmc);
+       if (wp < 0) {
+               if (mmc->getwp)
+                       wp = mmc->getwp(mmc);
+               else
+                       wp = 0;
+       }
 
        return wp;
 }
@@ -692,8 +696,12 @@ int mmc_getcd(struct mmc *mmc)
 
        cd = board_mmc_getcd(mmc);
 
-       if ((cd < 0) && mmc->getcd)
-               cd = mmc->getcd(mmc);
+       if (cd < 0) {
+               if (mmc->getcd)
+                       cd = mmc->getcd(mmc);
+               else
+                       cd = 1;
+       }
 
        return cd;
 }