Explorar o código

omap4 hsmmc: Fix the init if CONFIG_MMC_OMAP_HS is not set

Avoid possible crash if CONFIG_MMC_OMAP_HS is not set

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Madhusudhan Chikkature <madhu.cr@ti.com>
Cc: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Benoit Cousson <b-cousson@ti.com>
Signed-off-by: Kishore Kadiyala <kishore.kadiyala@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Benoit Cousson %!s(int64=14) %!d(string=hai) anos
pai
achega
531c21ba1a
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      arch/arm/mach-omap2/board-4430sdp.c

+ 7 - 1
arch/arm/mach-omap2/board-4430sdp.c

@@ -275,8 +275,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev)
 
 
 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
 static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev)
 {
 {
-	struct omap_mmc_platform_data *pdata = dev->platform_data;
+	struct omap_mmc_platform_data *pdata;
 
 
+	/* dev can be null if CONFIG_MMC_OMAP_HS is not set */
+	if (!dev) {
+		pr_err("Failed %s\n", __func__);
+		return;
+	}
+	pdata = dev->platform_data;
 	pdata->init =	omap4_twl6030_hsmmc_late_init;
 	pdata->init =	omap4_twl6030_hsmmc_late_init;
 }
 }