Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ab8d262 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Mark Brown
Browse files

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: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 44af7927
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -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)
int spi_setup(struct spi_device *spi)
{
{
	unsigned	bad_bits, ugly_bits;
	unsigned	bad_bits, ugly_bits;
	int		status = 0;
	int		status;


	/* check mode to prevent that DUAL and QUAD set at the same time
	/* 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)
	if (!spi->bits_per_word)
		spi->bits_per_word = 8;
		spi->bits_per_word = 8;


	if (__spi_validate_bits_per_word(spi->master, spi->bits_per_word))
	status = __spi_validate_bits_per_word(spi->master, spi->bits_per_word);
		return -EINVAL;
	if (status)
		return status;


	if (!spi->max_speed_hz)
	if (!spi->max_speed_hz)
		spi->max_speed_hz = spi->master->max_speed_hz;
		spi->max_speed_hz = spi->master->max_speed_hz;