From: Lars-Peter Clausen Date: Mon, 4 Mar 2013 19:30:00 +0000 (+0000) Subject: iio:ad7923: Return error if we didn't get the expected result X-Git-Tag: v3.10-rc1~192^2~537^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=135f06465d6842fdf1381f2610e27ff43e81f24d;p=platform%2Fupstream%2Fkernel-adaptation-pc.git 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 --- diff --git a/drivers/iio/adc/ad7923.c b/drivers/iio/adc/ad7923.c index 766c740..36eee24 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; }