summaryrefslogtreecommitdiff
path: root/drivers/iio
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2012-12-14 16:07:00 +0400
committerJonathan Cameron <jic23@kernel.org>2012-12-27 15:00:19 +0400
commit8434e7856551015650f62afa48e8f9e9b4bf80f2 (patch)
tree83b2a3302a4b54bb4abba2ba52b10ec4495568d3 /drivers/iio
parent0ce2fdaa97c6a8d84e9fce3d920a45a493145623 (diff)
downloadlinux-8434e7856551015650f62afa48e8f9e9b4bf80f2.tar.xz
iio: dac: ad5624r_spi: Don't set error code to voltage_uv
regulator_get_voltage() may return negative error code. Add error checking to avoid setting error code to voltage_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')
-rw-r--r--drivers/iio/dac/ad5624r_spi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c
index 6a7d6a48cc6d..14ea3dbf4902 100644
--- a/drivers/iio/dac/ad5624r_spi.c
+++ b/drivers/iio/dac/ad5624r_spi.c
@@ -238,7 +238,11 @@ static int __devinit ad5624r_probe(struct spi_device *spi)
if (ret)
goto error_put_reg;
- voltage_uv = regulator_get_voltage(st->reg);
+ ret = regulator_get_voltage(st->reg);
+ if (ret < 0)
+ goto error_disable_reg;
+
+ voltage_uv = ret;
}
spi_set_drvdata(spi, indio_dev);