lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56E7D198.4050900@ti.com>
Date:	Tue, 15 Mar 2016 14:40:48 +0530
From:	Sekhar Nori <nsekhar@...com>
To:	David Lechner <david@...hnology.com>
CC:	<khilman@...nel.org>, <ulf.hansson@...aro.org>,
	<linux-arm-kernel@...ts.infradead.org>,
	<linux-kernel@...r.kernel.org>, <linux-mmc@...r.kernel.org>
Subject: Re: [PATCH v2 2/5] mmc: davinci: fix unwinding in probe

On Tuesday 15 March 2016 04:24 AM, David Lechner wrote:
> Unwiding from an error in davinci_mmcsd_probe was a mess. Some errors were
> not handled and not all paths unwound correctly. Also using devm_ where
> possible to simplify things.
> 
> Signed-off-by: David Lechner <david@...hnology.com>
> ---
> 
> v2 changes: use devm_ where possible
> 
>  drivers/mmc/host/davinci_mmc.c | 93 ++++++++++++++++--------------------------
>  1 file changed, 35 insertions(+), 58 deletions(-)
> 
> diff --git a/drivers/mmc/host/davinci_mmc.c b/drivers/mmc/host/davinci_mmc.c
> index a294d261..6dd9562 100644
> --- a/drivers/mmc/host/davinci_mmc.c
> +++ b/drivers/mmc/host/davinci_mmc.c
> @@ -1223,7 +1223,7 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
>  	struct mmc_davinci_host *host = NULL;
>  	struct mmc_host *mmc = NULL;
>  	struct resource *r, *mem = NULL;
> -	int ret = 0, irq = 0;
> +	int ret, irq;
>  	size_t mem_size;
>  	const struct platform_device_id *id_entry;
>  
> @@ -1233,22 +1233,20 @@ static int __init davinci_mmcsd_probe(struct platform_device *pdev)
>  		return -ENOENT;
>  	}
>  
> -	ret = -ENODEV;
>  	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	irq = platform_get_irq(pdev, 0);
>  	if (!r || irq == NO_IRQ)
> -		goto out;
> +		return -ENODEV;
>  
> -	ret = -EBUSY;
>  	mem_size = resource_size(r);
> -	mem = request_mem_region(r->start, mem_size, pdev->name);
> +	mem = devm_request_mem_region(&pdev->dev, r->start, mem_size,
> +				      pdev->name);
>  	if (!mem)
> -		goto out;
> +		return -EBUSY;
>  
> -	ret = -ENOMEM;
>  	mmc = mmc_alloc_host(sizeof(struct mmc_davinci_host), &pdev->dev);
>  	if (!mmc)
> -		goto out;
> +		ret = -ENOMEM;

This should be 'return -ENOMEM' you dont want to proceed further if this
fails.

Other than that, looks fine to me.

Regards,
Sekhar

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ