iio: mlx90614: Check for errors in read values
The device uses the MSB of the returned temperature value as an error flag. Return a read error when this bit is set. Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
eb4b07dae4
commit
d02e0f8f62
|
@ -196,6 +196,11 @@ static int mlx90614_read_raw(struct iio_dev *indio_dev,
|
|||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* MSB is an error flag */
|
||||
if (ret & 0x8000)
|
||||
return -EIO;
|
||||
|
||||
*val = ret;
|
||||
return IIO_VAL_INT;
|
||||
case IIO_CHAN_INFO_OFFSET:
|
||||
|
|
Loading…
Reference in New Issue