From: Jarkko Lavinen Date: Thu, 6 Nov 2008 14:02:29 +0000 (+0200) Subject: OMAP: HSMMC: Fix oops in omap_mmc_remove X-Git-Tag: v2.6.28-omap1~76^2~4 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=0e9ebf6a224f6cff163432f05bc708511150858d;p=linux-2.6-omap-h63xx.git OMAP: HSMMC: Fix oops in omap_mmc_remove 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 --- diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 4bc25c0d51d..f4b7c306153 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -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);