]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
iio: proximity: as3935: move storm out of range check
authorMatt Ranostay <matt.ranostay@konsulko.com>
Thu, 27 Apr 2017 05:30:00 +0000 (22:30 -0700)
committerJonathan Cameron <jic23@kernel.org>
Thu, 27 Apr 2017 06:22:46 +0000 (07:22 +0100)
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>
drivers/iio/proximity/as3935.c

index ddf9bee89f777872ec27db426a46c18dd5da2fc3..aa0d0be1a6087ea653e2386ec95b56daf0ff468d 100644 (file)
@@ -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;