@@ -634,6 +634,11 @@ static int spi_dw_setup(struct spi_device *spi)
if (spi->bits_per_word != 8 && spi->bits_per_word != 16)
return -EINVAL;
+ if (!spi->max_speed_hz) {
+ dev_err(&spi->dev, "No max speed HZ parameter\n");
+ return -EINVAL;
+ }
+
/* Only alloc on first setup */
chip = spi_get_ctldata(spi);
if (!chip) {
@@ -675,10 +680,6 @@ static int spi_dw_setup(struct spi_device *spi)
}
chip->bits_per_word = spi->bits_per_word;
- if (!spi->max_speed_hz) {
- dev_err(&spi->dev, "No max speed HZ parameter\n");
- return -EINVAL;
- }
chip->speed_hz = spi->max_speed_hz;
chip->tmode = 0; /* Tx & Rx */