openwrtv4/target/linux/brcm63xx/patches-3.9/009-spi-bcm63xx-check-spi-bits_per_word-in-spi_setup.patch

30 lines
889 B
Diff
Raw Normal View History

From 13a364be644ed9b4666d452756556bb98afdcc56 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jogo@openwrt.org>
Date: Mon, 11 Mar 2013 13:48:27 +0100
Subject: [PATCH 07/12] 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>
---
drivers/spi/spi-bcm63xx.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/drivers/spi/spi-bcm63xx.c
+++ b/drivers/spi/spi-bcm63xx.c
@@ -151,8 +151,11 @@ static void bcm63xx_spi_setup_transfer(s
static int bcm63xx_spi_setup(struct spi_device *spi)
{
- if (!spi->bits_per_word)
- spi->bits_per_word = 8;
+ if (spi->bits_per_word != 8) {
+ dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
+ __func__, spi->bits_per_word);
+ return -EINVAL;
+ }
return 0;
}