mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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 <[email protected]> Cc: Patrick Vasseur <[email protected]> Cc: Christophe Leroy <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
This commit is contained in:
parent
6c23811ecb
commit
135f06465d
1 changed files with 2 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue