]> xenbits.xensource.com Git - people/sstabellini/linux-pvhvm-deprecated.git/commitdiff
mmc_attach_mmc: only call mmc_select_voltage if host->ocr_avail_mmc
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 20 Mar 2013 14:54:37 +0000 (14:54 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 20 Mar 2013 14:54:37 +0000 (14:54 +0000)
host->ocr_avail_mmc can be 0, in fact mmc_attach_mmc checks if
host->ocr_avail_mmc is not 0 before setting host->ocr_avail.

However later on, is going to call mmc_select_voltage regardeless of its
value. If host->ocr_avail_mmc is 0, host->ocr ends up being 0 too, and
mmc_select_voltage errors out.

This patch fixes that by only calling mmc_select_voltage iff
host->ocr_avail_mmc != 0.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
drivers/mmc/core/mmc.c

index c8f3d6e0684e6d7be348cec60e373287afdb1a21..165f6bd3db1ae2dded0f4bf73e8beb7be73e3641 100644 (file)
@@ -1563,14 +1563,15 @@ int mmc_attach_mmc(struct mmc_host *host)
                ocr &= ~0x7F;
        }
 
-       host->ocr = mmc_select_voltage(host, ocr);
-
-       /*
-        * Can we support the voltage of the card?
-        */
-       if (!host->ocr) {
-               err = -EINVAL;
-               goto err;
+       if (host->ocr_avail_mmc) {
+               host->ocr = mmc_select_voltage(host, ocr);
+               /*
+                * Can we support the voltage of the card?
+                */
+               if (!host->ocr) {
+                       err = -EINVAL;
+                       goto err;
+               }
        }
 
        /*