mxcmmc: fix error path in mxcmci_probe
authorUwe Kleine-König <[email protected]>
Tue, 15 Dec 2009 02:01:17 +0000 (18:01 -0800)
committerLinus Torvalds <[email protected]>
Tue, 15 Dec 2009 16:53:34 +0000 (08:53 -0800)
After a failing allocation of mmc or a failed ioremap in mxcmci_probe host was
used uninitialized.

Signed-off-by: Uwe Kleine-König <[email protected]>
Acked-by: Sascha Hauer <[email protected]>
Cc: Pierre Ossman <[email protected]>
Cc: Martin Fuzzey <[email protected]>
Cc: Pierre Ossman <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
drivers/mmc/host/mxcmmc.c

index 88671529c45d7690061f289d8fe005abd4701a09..60a2b69e54f569e6336c8efa2c25f8c05697a192 100644 (file)
@@ -679,17 +679,17 @@ static int mxcmci_probe(struct platform_device *pdev)
 {
        struct mmc_host *mmc;
        struct mxcmci_host *host = NULL;
-       struct resource *r;
+       struct resource *iores, *r;
        int ret = 0, irq;
 
        printk(KERN_INFO "i.MX SDHC driver\n");
 
-       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        irq = platform_get_irq(pdev, 0);
-       if (!r || irq < 0)
+       if (!iores || irq < 0)
                return -EINVAL;
 
-       r = request_mem_region(r->start, resource_size(r), pdev->name);
+       r = request_mem_region(iores->start, resource_size(iores), pdev->name);
        if (!r)
                return -EBUSY;
 
@@ -809,7 +809,7 @@ out_iounmap:
 out_free:
        mmc_free_host(mmc);
 out_release_mem:
-       release_mem_region(host->res->start, resource_size(host->res));
+       release_mem_region(iores->start, resource_size(iores));
        return ret;
 }