]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
OMAP: HSMMC: Fix oops in omap_mmc_remove
authorJarkko Lavinen <jarkko.lavinen@nokia.com>
Thu, 6 Nov 2008 14:02:29 +0000 (16:02 +0200)
committerAdrian Hunter <ext-adrian.hunter@nokia.com>
Thu, 27 Nov 2008 08:35:45 +0000 (10:35 +0200)
Do not access host in omap_mmc_remove() if it is null.  This
occurs when module is removed before its platform data is set.

Signed-off-by: Jarkko Lavinen <jarkko.lavinen@nokia.com>
drivers/mmc/host/omap_hsmmc.c

index 4bc25c0d51dc4396a787b76b072a7a2786d879f3..f4b7c30615311963402c5f7c527b146f121d2731 100644 (file)
@@ -1128,15 +1128,17 @@ static int omap_mmc_remove(struct platform_device *pdev)
        struct resource *res;
        u16 vdd = 0;
 
-       mmc_omap_fclk_state(host, ON);
-       if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) {
-       /*
-        * Set the vdd back to 3V,
-        * applicable for dual volt support.
-        */
-               vdd = fls(host->mmc->ocr_avail) - 1;
-               if (omap_mmc_switch_opcond(host, vdd) != 0)
-                       host->mmc->ios.vdd = vdd;
+       if (host) {
+               mmc_omap_fclk_state(host, ON);
+               if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) {
+                       /*
+                        * Set the vdd back to 3V,
+                        * applicable for dual volt support.
+                        */
+                       vdd = fls(host->mmc->ocr_avail) - 1;
+                       if (omap_mmc_switch_opcond(host, vdd) != 0)
+                               host->mmc->ios.vdd = vdd;
+               }
        }
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);