aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2012-12-14 02:47:00 -0500
committerJonathan Cameron <jic23@kernel.org>2012-12-27 05:59:56 -0500
commit36ce0c1c3ab7ea54fa6c2b3a0803c7ab0adcefbf (patch)
tree1e9b42dfe688996db2a84319d764a6ff92bb9766 /drivers/iio/adc
parent9541cc39a6381b76dac30c8e05078eb0a543f113 (diff)
iio: adc: ad7266: Don't set error code to st->vref_uv
regulator_get_voltage() may return negative error code. Add error checking to avoid setting error code to st->vref_uv. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r--drivers/iio/adc/ad7266.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c
index a6f4fc5f8201..e36107dc30b9 100644
--- a/drivers/iio/adc/ad7266.c
+++ b/drivers/iio/adc/ad7266.c
@@ -411,7 +411,11 @@ static int __devinit ad7266_probe(struct spi_device *spi)
411 if (ret) 411 if (ret)
412 goto error_put_reg; 412 goto error_put_reg;
413 413
414 st->vref_uv = regulator_get_voltage(st->reg); 414 ret = regulator_get_voltage(st->reg);
415 if (ret < 0)
416 goto error_disable_reg;
417
418 st->vref_uv = ret;
415 } else { 419 } else {
416 /* Use internal reference */ 420 /* Use internal reference */
417 st->vref_uv = 2500000; 421 st->vref_uv = 2500000;