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: <20140114125242.GE15567@sirena.org.uk>
Date:	Tue, 14 Jan 2014 12:52:42 +0000
From:	Mark Brown <broonie@...nel.org>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:	linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org,
	Geert Uytterhoeven <geert+renesas@...ux-m68k.org>
Subject: Re: [PATCH/RFC] spi: core: Fix logic mismatch in spi_master.set_cs()

On Tue, Jan 14, 2014 at 12:36:51PM +0100, Geert Uytterhoeven wrote:

>  {
> -	if (spi->mode & SPI_CS_HIGH)
> -		enable = !enable;
> -
> -	if (spi->cs_gpio >= 0)
> +	if (spi->cs_gpio >= 0) {
> +		if (spi->mode & SPI_CS_HIGH)
> +			enable = !enable;
>  		gpio_set_value(spi->cs_gpio, !enable);
> -	else if (spi->master->set_cs)
> -		spi->master->set_cs(spi, !enable);
> +	} else if (spi->master->set_cs)
> +		spi->master->set_cs(spi, enable);
>  }

Coding style, braces on all branches of an if statement.

This also pushes the handling of CS_HIGH back out into the driver which
doesn't seem like it's helping anything.  Flipping the sense of enable
when calling set_cs() is probably OK though.

Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ