[PATCH] mmc: omap_hsmmc: release correct resource

S, Venkatraman svenkatr at ti.com
Tue Apr 17 02:43:53 EDT 2012


On Sat, Apr 14, 2012 at 7:11 PM, Russell King - ARM Linux
<linux at arm.linux.org.uk> wrote:
> 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 <rmk+kernel at arm.linux.org.uk>
> ---
>  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 d12bdbe..4b2e1f0 100644
> --- a/drivers/mmc/host/omap_hsmmc.c
> +++ b/drivers/mmc/host/omap_hsmmc.c
> @@ -2027,7 +2027,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;
>  }
>
> --

Thanks Russell. I'll send it to Chris to be queued for 3.4-fixes.



More information about the linux-arm-kernel mailing list