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] [day] [month] [year] [list]
Message-Id: <20120309232710.45C763E08B7@localhost>
Date:	Fri, 09 Mar 2012 16:27:10 -0700
From:	Grant Likely <grant.likely@...retlab.ca>
To:	Axel Lin <axel.lin@...il.com>, linux-kernel@...r.kernel.org
Cc:	Shawn Guo <shawn.guo@...aro.org>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	spi-devel-general@...ts.sourceforge.net
Subject: Re: [PATCH RESEND] spi/imx: simplify error handling to free gpios

On Tue, 10 Jan 2012 15:27:36 +0800, Axel Lin <axel.lin@...il.com> wrote:
> Simplify the error handling by moving the code to free gpios in one place.
> 
> Signed-off-by: Axel Lin <axel.lin@...il.com>
> Acked-by: Shawn Guo <shawn.guo@...aro.org>

Applied, thanks.

g.

> ---
>  drivers/spi/spi-imx.c |   11 +++--------
>  1 files changed, 3 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
> index c6e697f..31054e3 100644
> --- a/drivers/spi/spi-imx.c
> +++ b/drivers/spi/spi-imx.c
> @@ -793,13 +793,8 @@ static int __devinit spi_imx_probe(struct platform_device *pdev)
>  
>  		ret = gpio_request(spi_imx->chipselect[i], DRIVER_NAME);
>  		if (ret) {
> -			while (i > 0) {
> -				i--;
> -				if (spi_imx->chipselect[i] >= 0)
> -					gpio_free(spi_imx->chipselect[i]);
> -			}
>  			dev_err(&pdev->dev, "can't get cs gpios\n");
> -			goto out_master_put;
> +			goto out_gpio_free;
>  		}
>  	}
>  
> @@ -881,10 +876,10 @@ out_iounmap:
>  out_release_mem:
>  	release_mem_region(res->start, resource_size(res));
>  out_gpio_free:
> -	for (i = 0; i < master->num_chipselect; i++)
> +	while (--i >= 0) {
>  		if (spi_imx->chipselect[i] >= 0)
>  			gpio_free(spi_imx->chipselect[i]);
> -out_master_put:
> +	}
>  	spi_master_put(master);
>  	kfree(master);
>  	platform_set_drvdata(pdev, NULL);
> -- 
> 1.7.5.4
> 
> 
> 

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies,Ltd.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ