From 135f06465d6842fdf1381f2610e27ff43e81f24d Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 Mar 2013 19:30:00 +0000 Subject: [PATCH] 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 Cc: Patrick Vasseur Cc: Christophe Leroy Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ad7923.c | 2 ++ 1 file changed, 2 insertions(+) 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, if (chan->address == EXTRACT(ret, 12, 4)) *val = EXTRACT(ret, 0, 12); + else + return -EIO; return IIO_VAL_INT; }