Commit d02e0f8f authored by Vianney le Clément de Saint-Marcq's avatar Vianney le Clément de Saint-Marcq Committed by Jonathan Cameron

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: default avatarVianney le Clément de Saint-Marcq <vianney.leclement@essensium.com>
Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent eb4b07da
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment