summaryrefslogtreecommitdiffstats
path: root/drivers/iio/light/ltr501.c
diff options
context:
space:
mode:
authorKuppuswamy Sathyanarayanan2015-05-16 01:42:56 +0200
committerJonathan Cameron2015-05-16 12:09:06 +0200
commit01e537f73335339196be3ef2bbfe53c20a6cb200 (patch)
tree8b19dd81de50b941d5f79a168625b373333fe0d6 /drivers/iio/light/ltr501.c
parentiio:temp:mlx90614 trivial drop of unnecessary ret return from write_raw. (diff)
downloadkernel-qcow2-linux-01e537f73335339196be3ef2bbfe53c20a6cb200.tar.gz
kernel-qcow2-linux-01e537f73335339196be3ef2bbfe53c20a6cb200.tar.xz
kernel-qcow2-linux-01e537f73335339196be3ef2bbfe53c20a6cb200.zip
iio: ltr501: Fix proximity threshold boundary check
Currently, proximity sensor boundary check is done inside the switch block but outside the case statement.Since this code will never get executed, moved the check outside the switch case statement. 867 case IIO_PROXIMITY: 868 switch (dir) { // Following line has been moved outside the switch block. 869 if (val > LTR501_PS_THRESH_MASK) 870 return -EINVAL; 871 case IIO_EV_DIR_RISING: Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/light/ltr501.c')
-rw-r--r--drivers/iio/light/ltr501.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index 280eff19b872..64e235281cef 100644
--- a/drivers/iio/light/ltr501.c
+++ b/drivers/iio/light/ltr501.c
@@ -865,9 +865,9 @@ static int ltr501_write_thresh(struct iio_dev *indio_dev,
return -EINVAL;
}
case IIO_PROXIMITY:
- switch (dir) {
if (val > LTR501_PS_THRESH_MASK)
return -EINVAL;
+ switch (dir) {
case IIO_EV_DIR_RISING:
mutex_lock(&data->lock_ps);
ret = regmap_bulk_write(data->regmap,