aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2013-03-04 14:30:00 -0500
committerJonathan Cameron <jic23@kernel.org>2013-03-17 16:16:40 -0400
commit135f06465d6842fdf1381f2610e27ff43e81f24d (patch)
tree9f2b4b2cd4b1ca841dc650a45b93b790b78d6664 /drivers/iio
parent6c23811ecb24e077081d04c7af511d94746419ab (diff)
iio:ad7923: Return error if we didn't get the expected result
Instead of leaving 'val' uninitialized return an error if the result's address did not match that of the channel we were trying to read. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Cc: Patrick Vasseur <patrick.vasseur@c-s.fr> Cc: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/adc/ad7923.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/iio/adc/ad7923.c b/drivers/iio/adc/ad7923.c
index 766c74026be2..36eee248a9f6 100644
--- a/drivers/iio/adc/ad7923.c
+++ b/drivers/iio/adc/ad7923.c
@@ -199,6 +199,8 @@ static int ad7923_read_raw(struct iio_dev *indio_dev,
199 199
200 if (chan->address == EXTRACT(ret, 12, 4)) 200 if (chan->address == EXTRACT(ret, 12, 4))
201 *val = EXTRACT(ret, 0, 12); 201 *val = EXTRACT(ret, 0, 12);
202 else
203 return -EIO;
202 204
203 return IIO_VAL_INT; 205 return IIO_VAL_INT;
204 } 206 }