mfd: asic3: Fix potential null pointer dereference
[linux-2.6-microblaze.git] / drivers / mfd / asic3.c
index 9f6294f..9fc4186 100644 (file)
@@ -899,13 +899,15 @@ static int __init asic3_mfd_probe(struct platform_device *pdev,
        ds1wm_resources[0].end   >>= asic->bus_shift;
 
        /* MMC */
-       asic->tmio_cnf = ioremap((ASIC3_SD_CONFIG_BASE >> asic->bus_shift) +
+       if (mem_sdio) {
+               asic->tmio_cnf = ioremap((ASIC3_SD_CONFIG_BASE >> asic->bus_shift) +
                                 mem_sdio->start,
                                 ASIC3_SD_CONFIG_SIZE >> asic->bus_shift);
-       if (!asic->tmio_cnf) {
-               ret = -ENOMEM;
-               dev_dbg(asic->dev, "Couldn't ioremap SD_CONFIG\n");
-               goto out;
+               if (!asic->tmio_cnf) {
+                       ret = -ENOMEM;
+                       dev_dbg(asic->dev, "Couldn't ioremap SD_CONFIG\n");
+                       goto out;
+               }
        }
        asic3_mmc_resources[0].start >>= asic->bus_shift;
        asic3_mmc_resources[0].end   >>= asic->bus_shift;