mmc: core: Fixup Oops for SDIO shutdown
authorUlf Hansson <ulf.hansson@linaro.org>
Tue, 2 Jul 2013 10:53:01 +0000 (12:53 +0200)
committerChris Ball <cjb@laptop.org>
Fri, 5 Jul 2013 16:51:22 +0000 (12:51 -0400)
Commit "mmc: core: Handle card shutdown from mmc_bus" introduced an
Oops in the shutdown sequence for SDIO.

The drv pointer, does not exist for SDIO since the probing of the SDIO
card from the mmc_bus perspective is expected to fail by returning
-ENODEV.

This patch adds the proper check for the pointer before calling it.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reported-by: Stephen Warren <swarren@wwwdotorg.org>
Reported-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com>
Tested-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com>
Acked-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/core/bus.c

index 4c0decfffb5369062e539ea8f8d25d81fd811755..d4b99bbe0781137c43c6758e630c26f4d3503a36 100644 (file)
@@ -129,7 +129,8 @@ static void mmc_bus_shutdown(struct device *dev)
        struct mmc_host *host = card->host;
        int ret;
 
-       drv->shutdown(card);
+       if (dev->driver && drv->shutdown)
+               drv->shutdown(card);
 
        if (host->bus_ops->shutdown) {
                ret = host->bus_ops->shutdown(host);