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: <55DB9405.1080806@tronnes.org>
Date:	Tue, 25 Aug 2015 00:00:37 +0200
From:	Noralf Trønnes <noralf@...nnes.org>
To:	Stefan Wahren <stefan.wahren@...e.com>,
	Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Mark Brown <broonie@...nel.org>,
	Henri Chain <henri.chain@...ves.ec-nantes.fr>,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC 2/2] staging: fbtft: fix 9-bit SPI support detection


Den 24.08.2015 20:33, skrev Stefan Wahren:
> Since bits_per_word isn't usually checked during SPI setup the 9-bit
> support must be checked manually.
>
> Signed-off-by: Stefan Wahren <stefan.wahren@...e.com>
> ---
>   drivers/staging/fbtft/fbtft-core.c |    7 +++++++
>   drivers/staging/fbtft/flexfb.c     |    7 +++++++
>   2 files changed, 14 insertions(+)
>
> diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
> index 3638554..bd71487 100644
> --- a/drivers/staging/fbtft/fbtft-core.c
> +++ b/drivers/staging/fbtft/fbtft-core.c
> @@ -1438,6 +1438,13 @@ int fbtft_probe_common(struct fbtft_display *display,
>   	if (par->spi && display->buswidth == 9) {
>   		par->spi->bits_per_word = 9;
>   		ret = spi_setup(par->spi);
> +		if (!ret) {
> +			struct spi_master *ma = par->spi->master;
> +
> +			if (!(ma->bits_per_word_mask & SPI_BPW_MASK(9)))
> +				ret = -EINVAL;
> +		}
> +
>   		if (ret) {

There's no point in calling spi_setup() when it doesn't check bits_per_word.
Apparently this changed with the commit:
spi: convert drivers to use bits_per_word_mask.
This has not been detected earlier, because FBTFT was previously mostly
used on the Raspberry Pi which had a downstream SPI driver that did this 
check.

How about this:

-                par->spi->bits_per_word = 9;
-                ret = par->spi->master->setup(par->spi);
+                if (par->spi->master->bits_per_word_mask & 
SPI_BPW_MASK(9)) {
+                        par->spi->bits_per_word = 9;
-                if (ret) {
+                } else {
                          dev_warn(&par->spi->dev,
                                  "9-bit SPI not available, emulating 
using 8-bit.\n");
-                        par->spi->bits_per_word = 8;
-                        ret = par->spi->master->setup(par->spi);
-                        if (ret)
-                                goto out_release;
                          /* allocate buffer with room for dc bits */
                          par->extra = devm_kzalloc(par->info->device,

--
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