From 48b332f9916f33ba0001b78e5cea49ef17f3c81e Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 18 Apr 2012 11:11:57 +0100 Subject: [PATCH] mmc: omap_hsmmc: release correct resource res can be one of several resources, as this variable is re-used several times during probe. This can cause the wrong resource parameters to be passed to release_mem_region(). Get the original memory resource before calling release_mem_region(). Signed-off-by: Russell King Acked-by: Tony Lindgren Signed-off-by: Chris Ball --- drivers/mmc/host/omap_hsmmc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 4254b6f310aa..d15b149649bf 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -2042,7 +2042,9 @@ static int __devinit omap_hsmmc_probe(struct platform_device *pdev) err_alloc: omap_hsmmc_gpio_free(pdata); err: - release_mem_region(res->start, resource_size(res)); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (res) + release_mem_region(res->start, resource_size(res)); return ret; }