Skip to content

Commit

Permalink
iio: dac: ad5380: Don't set error code to st->vref
Browse files Browse the repository at this point in the history
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 <axel.lin@ingics.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
  • Loading branch information
Axel Lin authored and Jonathan Cameron committed Dec 27, 2012
1 parent 36ce0c1 commit 272cc9c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/iio/dac/ad5380.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,11 @@ static int __devinit ad5380_probe(struct device *dev, struct regmap *regmap,
goto error_free_reg;
}

st->vref = regulator_get_voltage(st->vref_reg);
ret = regulator_get_voltage(st->vref_reg);
if (ret < 0)
goto error_disable_reg;

st->vref = ret;
} else {
st->vref = st->chip_info->int_vref;
ctrl |= AD5380_CTRL_INT_VREF_EN;
Expand Down

0 comments on commit 272cc9c

Please sign in to comment.