diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 84c2861d6f4d..619c7df0d27f 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1156,7 +1156,7 @@ EXPORT_SYMBOL_GPL(spi_busnum_to_master); int spi_setup(struct spi_device *spi) { unsigned bad_bits; - int status; + int status = 0; /* help drivers fail *cleanly* when they need options * that aren't supported with their current master @@ -1171,7 +1171,8 @@ int spi_setup(struct spi_device *spi) if (!spi->bits_per_word) spi->bits_per_word = 8; - status = spi->master->setup(spi); + if (spi->master->setup) + status = spi->master->setup(spi); dev_dbg(&spi->dev, "setup mode %d, %s%s%s%s" "%u bits/w, %u Hz max --> %d\n",