Skip to content

Commit

Permalink
mxcmmc: fix error path in mxcmci_probe
Browse files Browse the repository at this point in the history
After a failing allocation of mmc or a failed ioremap in mxcmci_probe host was
used uninitialized.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pierre Ossman <pierre@ossman.eu>
Cc: Martin Fuzzey <mfuzzey@gmail.com>
Cc: Pierre Ossman <drzeus@drzeus.cx>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Uwe Kleine-König authored and Linus Torvalds committed Dec 15, 2009
1 parent 9b6e3e4 commit c0521ba
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/mmc/host/mxcmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -809,7 +809,7 @@ static int mxcmci_probe(struct platform_device *pdev)
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;
}

Expand Down

0 comments on commit c0521ba

Please sign in to comment.