Skip to content

Commit

Permalink
iio: adc: cc10001: Fix regulator_get_voltage() return value check
Browse files Browse the repository at this point in the history
regulator_get_voltage() returns a non-negative value in case of success,
and a negative error in case of error. Let's fix this.

Fixes: 1664f6a ("iio: adc: Cosmic Circuits 10001 ADC driver")
Signed-off-by: Naidu Tellapati <[email protected]>
Signed-off-by: Ezequiel Garcia <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
  • Loading branch information
Naidu Tellapati authored and jic23 committed May 12, 2015
1 parent 713276e commit 65a761b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/adc/cc10001_adc.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ static int cc10001_adc_read_raw(struct iio_dev *indio_dev,

case IIO_CHAN_INFO_SCALE:
ret = regulator_get_voltage(adc_dev->reg);
if (ret)
if (ret < 0)
return ret;

*val = ret / 1000;
Expand Down

0 comments on commit 65a761b

Please sign in to comment.