iio: lidar: return -EINVAL on invalid signal
authorMatt Ranostay <mranostay@gmail.com>
Tue, 27 Oct 2015 03:18:23 +0000 (20:18 -0700)
committerJonathan Cameron <jic23@kernel.org>
Sat, 21 Nov 2015 15:56:53 +0000 (15:56 +0000)
commit45a6b8218df54087c3bb8dc731424d8789d31790
tree4807f065fc392f11cf68667c75244a398b2547c2
parent2e9fed42209b17116c6221e136ccbd3f252f5f86
iio: lidar: return -EINVAL on invalid signal

Returning zero from the measurment function has the side effect of
corrupting the triggered buffer readings, better to use -EINVAL than
a zero measurement reading.

The INVALID status happens even it isn't out of range
sometimes roughly once every second or two. This can be from an
invalid second signal return path. Hence there are spurious zero
readings from the triggered buffer, and warning messages in the kernel
log.

Signed-off-by: Matt Ranostay <mranostay@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c