summaryrefslogtreecommitdiff
path: root/drivers/staging/iio
diff options
context:
space:
mode:
authorAlexandru Tachici <alexandru.tachici@analog.com>2020-02-12 18:17:17 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2020-03-08 17:28:32 +0000
commitab0afa65bbc7eee9a4f5d864781e949820e0aa2c (patch)
tree4b8390c63bc227754707d6311a02a1bd557aa6bf /drivers/staging/iio
parent1d8690fe61c9e83a59b74a223ab94de3f889bc74 (diff)
staging: iio: adc: ad7192: fail probe on get_voltage
This patch makes the ad7192_probe fail in case regulator_get_voltage will return an error or voltage is set to 0. Signed-off-by: Alexandru Tachici <alexandru.tachici@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r--drivers/staging/iio/adc/ad7192.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index bf3e2a9cc07f..41da8b4cdc48 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -899,10 +899,13 @@ static int ad7192_probe(struct spi_device *spi)
voltage_uv = regulator_get_voltage(st->avdd);
- if (voltage_uv)
+ if (voltage_uv > 0) {
st->int_vref_mv = voltage_uv / 1000;
- else
+ } else {
+ ret = voltage_uv;
dev_err(&spi->dev, "Device tree error, reference voltage undefined\n");
+ goto error_disable_avdd;
+ }
spi_set_drvdata(spi, indio_dev);
st->devid = spi_get_device_id(spi)->driver_data;