Commit e2bdae06329ef3fb8918032735cd963efc701b7e

Authored by Jonas Gorski
Committed by Mark Brown
1 parent 52f83bbd65

spi/bcm63xx: check spi bits_per_word in spi_setup

Instead of fixing up the bits_per_word (which the spi subsystem already
does for us), check it for supported values.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Acked-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff

drivers/spi/spi-bcm63xx.c
... ... @@ -151,8 +151,11 @@
151 151  
152 152 static int bcm63xx_spi_setup(struct spi_device *spi)
153 153 {
154   - if (!spi->bits_per_word)
155   - spi->bits_per_word = 8;
  154 + if (spi->bits_per_word != 8) {
  155 + dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
  156 + __func__, spi->bits_per_word);
  157 + return -EINVAL;
  158 + }
156 159  
157 160 return 0;
158 161 }