From: Axel Lin Date: Fri, 14 Dec 2012 07:47:00 +0000 (+0000) Subject: iio: adc: ad7266: Don't set error code to st->vref_uv X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=36ce0c1c3ab7ea54fa6c2b3a0803c7ab0adcefbf;p=openwrt%2Fstaging%2Fblogic.git 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 Acked-by: Lars-Peter Clausen Signed-off-by: Jonathan Cameron --- 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) if (ret) goto error_put_reg; - st->vref_uv = regulator_get_voltage(st->reg); + ret = regulator_get_voltage(st->reg); + if (ret < 0) + goto error_disable_reg; + + st->vref_uv = ret; } else { /* Use internal reference */ st->vref_uv = 2500000;