summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2012-12-14 13:07:00 +0100
committerJonathan Cameron <jic23@kernel.org>2012-12-27 12:00:19 +0100
commit8434e7856551015650f62afa48e8f9e9b4bf80f2 (patch)
tree83b2a3302a4b54bb4abba2ba52b10ec4495568d3 /drivers/iio
parentiio: dac: ad5504: Don't set error code to voltage_uv (diff)
downloadlinux-8434e7856551015650f62afa48e8f9e9b4bf80f2.tar.xz
linux-8434e7856551015650f62afa48e8f9e9b4bf80f2.zip
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);