summaryrefslogtreecommitdiff
path: root/drivers/iio/proximity
diff options
context:
space:
mode:
authorMatt Ranostay <matt.ranostay@konsulko.com>2017-04-27 08:30:00 +0300
committerJonathan Cameron <jic23@kernel.org>2017-04-27 09:22:46 +0300
commitd532e5b2bc4724b3c493c1be58e3f1686c1e4fe7 (patch)
treee26e39b0858db02b9199539f26a497eea79c90a0 /drivers/iio/proximity
parentc894acc7bf400d039bf740420b22f0b71b7fb504 (diff)
downloadlinux-d532e5b2bc4724b3c493c1be58e3f1686c1e4fe7.tar.xz
iio: proximity: as3935: move storm out of range check
Move out of storm check to apply to IIO_CHAN_INFO_RAW so the reported results are constant between the former and the IIO_CHAN_INFO_PROCESSED Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/proximity')
-rw-r--r--drivers/iio/proximity/as3935.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
index ddf9bee89f77..aa0d0be1a608 100644
--- a/drivers/iio/proximity/as3935.c
+++ b/drivers/iio/proximity/as3935.c
@@ -176,13 +176,13 @@ static int as3935_read_raw(struct iio_dev *indio_dev,
if (ret)
return ret;
- if (m == IIO_CHAN_INFO_RAW)
- return IIO_VAL_INT;
-
/* storm out of range */
if (*val == AS3935_DATA_MASK)
return -EINVAL;
+ if (m == IIO_CHAN_INFO_RAW)
+ return IIO_VAL_INT;
+
if (m == IIO_CHAN_INFO_PROCESSED)
*val *= 1000;
break;