iio: pressure: ms5611: changed hardcoded SPI speed to value limited
authorMitja Spes <mitja@lxnav.com>
Fri, 21 Oct 2022 13:58:21 +0000 (15:58 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Nov 2022 16:35:41 +0000 (17:35 +0100)
commit 741cec30cc52058d1c10d415f3b98319887e4f73 upstream.

Don't hardcode the ms5611 SPI speed, limit it instead.

Signed-off-by: Mitja Spes <mitja@lxnav.com>
Fixes: c0644160a8b5 ("iio: pressure: add support for MS5611 pressure and temperature sensor")
Link: https://lore.kernel.org/r/20221021135827.1444793-3-mitja@lxnav.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/iio/pressure/ms5611_spi.c

index 932e05001e1a91fa1a7a211f75491005f197bc93..a582515ae2e6bb499892a8b76a871bac865abb0b 100644 (file)
@@ -95,7 +95,7 @@ static int ms5611_spi_probe(struct spi_device *spi)
        spi_set_drvdata(spi, indio_dev);
 
        spi->mode = SPI_MODE_0;
-       spi->max_speed_hz = 20000000;
+       spi->max_speed_hz = min(spi->max_speed_hz, 20000000U);
        spi->bits_per_word = 8;
        ret = spi_setup(spi);
        if (ret < 0)