spi: core: propagate return code of __spi_validate_bits_per_word()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Wed, 14 Oct 2015 19:43:07 +0000 (22:43 +0300)
committerMark Brown <broonie@kernel.org>
Fri, 16 Oct 2015 15:05:33 +0000 (16:05 +0100)
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>
drivers/spi/spi.c

index 40c9afac047fa5cda08246b0dbd715d80d9d8513..64c1aedde4817f8524d66ad8a829d2eb576f3194 100644 (file)
@@ -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;