summaryrefslogtreecommitdiff
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2015-10-14 22:43:07 +0300
committerMark Brown <broonie@kernel.org>2015-10-16 18:05:33 +0300
commit5ab8d262122bc951b308e51cdcc55bc67b1f5fdb (patch)
treed55527ce037ab3b85b96ce906bea8986faa07f38 /drivers/spi/spi.c
parent44af7927316e83eb8865933f7c836dcc85f8eb74 (diff)
downloadlinux-5ab8d262122bc951b308e51cdcc55bc67b1f5fdb.tar.xz
spi: core: propagate return code of __spi_validate_bits_per_word()
Propagate the actual return code of __spi_validate_bits_per_word() in spi_setup(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 40c9afac047f..64c1aedde481 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1956,7 +1956,7 @@ static int __spi_validate_bits_per_word(struct spi_master *master, u8 bits_per_w
int spi_setup(struct spi_device *spi)
{
unsigned bad_bits, ugly_bits;
- int status = 0;
+ int status;
/* check mode to prevent that DUAL and QUAD set at the same time
*/
@@ -1993,8 +1993,9 @@ int spi_setup(struct spi_device *spi)
if (!spi->bits_per_word)
spi->bits_per_word = 8;
- if (__spi_validate_bits_per_word(spi->master, spi->bits_per_word))
- return -EINVAL;
+ status = __spi_validate_bits_per_word(spi->master, spi->bits_per_word);
+ if (status)
+ return status;
if (!spi->max_speed_hz)
spi->max_speed_hz = spi->master->max_speed_hz;