mmc_get_dev: Return error if mmc_init fails
authorBenoît Thébaudeau <benoit.thebaudeau@advansee.com>
Fri, 10 Aug 2012 08:59:12 +0000 (08:59 +0000)
committerAndy Fleming <afleming@freescale.com>
Wed, 5 Sep 2012 22:32:42 +0000 (17:32 -0500)
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Andy Fleming <afleming@gmail.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
drivers/mmc/mmc.c

index 64abe5b1c8597a396eb3d877926e328f7466b88f..a60cfe1cb0d181be890bc2a8a2de9d209b3e99b3 100644 (file)
@@ -1286,10 +1286,9 @@ int mmc_register(struct mmc *mmc)
 block_dev_desc_t *mmc_get_dev(int dev)
 {
        struct mmc *mmc = find_mmc_device(dev);
-       if (!mmc)
+       if (!mmc || mmc_init(mmc))
                return NULL;
 
-       mmc_init(mmc);
        return &mmc->block_dev;
 }
 #endif