aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2012-12-14 07:07:00 -0500
committerJonathan Cameron <jic23@kernel.org>2012-12-27 06:00:19 -0500
commit8434e7856551015650f62afa48e8f9e9b4bf80f2 (patch)
tree83b2a3302a4b54bb4abba2ba52b10ec4495568d3 /drivers/iio
parent0ce2fdaa97c6a8d84e9fce3d920a45a493145623 (diff)
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)
238 if (ret) 238 if (ret)
239 goto error_put_reg; 239 goto error_put_reg;
240 240
241 voltage_uv = regulator_get_voltage(st->reg); 241 ret = regulator_get_voltage(st->reg);
242 if (ret < 0)
243 goto error_disable_reg;
244
245 voltage_uv = ret;
242 } 246 }
243 247
244 spi_set_drvdata(spi, indio_dev); 248 spi_set_drvdata(spi, indio_dev);