Skip to content

Commit

Permalink
iio:ad7923: Return error if we didn't get the expected result
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lars-Peter Clausen authored and Jonathan Cameron committed Mar 17, 2013
1 parent 6c23811 commit 135f064
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/iio/adc/ad7923.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 135f064

Please sign in to comment.