lkml.org 
[lkml]   [2009]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] SDIO driver for Marvell SoCs
On Thu, 19 Feb 2009, Andrew Morton wrote:

> --- a/drivers/mmc/host/mvsdio.c~sdio-driver-for-marvell-socs-update
> +++ a/drivers/mmc/host/mvsdio.c
> @@ -783,9 +783,9 @@ out:
> gpio_free(host->gpio_write_protect);
> if (host->base)
> iounmap(host->base);
> - if (host->res)
> - release_resource(host->res);
> }
> + if (r)
> + release_resource(host->res);
> if (mmc)
> mmc_free_host(mmc);
>
> _
>
> Nope, this will deref a null pointer on that error path and wouldn't
> release the right thing anyway.

Obviously. I'm just too stupid sometimes. A s/host->res/r/ in both
places would be better.

> Something like this...
>
> --- a/drivers/mmc/host/mvsdio.c~sdio-driver-for-marvell-socs-update
> +++ a/drivers/mmc/host/mvsdio.c
> @@ -688,6 +688,7 @@ static int __init mvsd_probe(struct plat
>
> mmc = mmc_alloc_host(sizeof(struct mvsd_host), &pdev->dev);
> if (!mmc) {
> + release_resource(r);
> ret = -ENOMEM;
> goto out;
> }

That's fine too.


Nicolas


\
 
 \ /
  Last update: 2009-02-20 02:45    [W:0.295 / U:0.520 seconds]
©2003-2011 Jasper Spaans. Advertise on this site