drivers/iio/adc/ad7173.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Check the return value of spi_setup() and propagate the error in the
ad7173_probe() function. This is unlikely to happen since virtually
every SPI controller supports SPI_MODE_3, but still always a good idea
to check the return value.
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
drivers/iio/adc/ad7173.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c
index 69de5886474ce2f700bf277ce707b15637113564..911001be368302fb9d7d6e8da3783751fe0f61c5 100644
--- a/drivers/iio/adc/ad7173.c
+++ b/drivers/iio/adc/ad7173.c
@@ -1775,7 +1775,9 @@ static int ad7173_probe(struct spi_device *spi)
indio_dev->info = &ad7173_info;
spi->mode = SPI_MODE_3;
- spi_setup(spi);
+ ret = spi_setup(spi);
+ if (ret)
+ return ret;
ret = ad_sd_init(&st->sd, indio_dev, spi, st->info->sd_info);
if (ret)
---
base-commit: aff301f37e220970c2f301b5c65a8bfedf52058e
change-id: 20250611-iio-adc-ad7173-check-spi_setup-return-072017235f3c
Best regards,
--
David Lechner <dlechner@baylibre.com>
On Wed, 11 Jun 2025 09:40:16 -0500 David Lechner <dlechner@baylibre.com> wrote: > Check the return value of spi_setup() and propagate the error in the > ad7173_probe() function. This is unlikely to happen since virtually > every SPI controller supports SPI_MODE_3, but still always a good idea > to check the return value. > > Signed-off-by: David Lechner <dlechner@baylibre.com> Applied. > --- > drivers/iio/adc/ad7173.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/iio/adc/ad7173.c b/drivers/iio/adc/ad7173.c > index 69de5886474ce2f700bf277ce707b15637113564..911001be368302fb9d7d6e8da3783751fe0f61c5 100644 > --- a/drivers/iio/adc/ad7173.c > +++ b/drivers/iio/adc/ad7173.c > @@ -1775,7 +1775,9 @@ static int ad7173_probe(struct spi_device *spi) > indio_dev->info = &ad7173_info; > > spi->mode = SPI_MODE_3; > - spi_setup(spi); > + ret = spi_setup(spi); > + if (ret) > + return ret; > > ret = ad_sd_init(&st->sd, indio_dev, spi, st->info->sd_info); > if (ret) > > --- > base-commit: aff301f37e220970c2f301b5c65a8bfedf52058e > change-id: 20250611-iio-adc-ad7173-check-spi_setup-return-072017235f3c > > Best regards,
© 2016 - 2025 Red Hat, Inc.