diff options
author | Axel Lin <axel.lin@ingics.com> | 2012-12-14 16:07:00 +0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2012-12-27 15:00:19 +0400 |
commit | 8434e7856551015650f62afa48e8f9e9b4bf80f2 (patch) | |
tree | 83b2a3302a4b54bb4abba2ba52b10ec4495568d3 /drivers/iio | |
parent | 0ce2fdaa97c6a8d84e9fce3d920a45a493145623 (diff) | |
download | linux-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.c | 6 |
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); |