Skip to content

Commit

Permalink
iio: ltr501: Fix proximity threshold boundary check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kuppuswamy Sathyanarayanan authored and Jonathan Cameron committed May 16, 2015
1 parent f2c714a commit 01e537f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/iio/light/ltr501.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 01e537f

Please sign in to comment.