Skip to contentSkip to conversation

iio: ltr501: Add interrupt support

DISCUSSION Dan Carpenter 2 participants 2 messages May 12, 2015 IIO

lore
Share & tools
lore
#0 lore raw

Hello Kuppuswamy Sathyanarayanan,

The patch 7ac702b3144b: "iio: ltr501: Add interrupt support" from Apr 19, 2015, leads to the following static checker warning:

	drivers/iio/light/ltr501.c:869 ltr501_write_thresh()
	info: ignoring unreachable code.

drivers/iio/light/ltr501.c
867 case IIO_PROXIMITY:
868 switch (dir) {
869 if (val > LTR501_PS_THRESH_MASK)
870 return -EINVAL;

Probably this code should be outside of this switch (dir) statement?

   871                  case IIO_EV_DIR_RISING:
   872                          mutex_lock(&data->lock_ps);
   873                          ret = regmap_bulk_write(data->regmap,
   874                                                  LTR501_PS_THRESH_UP,
   875                                                  &val, 2);
   876                          mutex_unlock(&data->lock_ps);
   877                          return ret;
   878                  case IIO_EV_DIR_FALLING:
   879                          mutex_lock(&data->lock_ps);
   880                          ret = regmap_bulk_write(data->regmap,
   881                                                  LTR501_PS_THRESH_LOW,
   882                                                  &val, 2);
   883                          mutex_unlock(&data->lock_ps);
   884                          return ret;
   885                  default:
   886                          return -EINVAL;
   887                  }
   888          default:
   889                  return -EINVAL;
   890          }
   891  
   892          return -EINVAL;
   893  }

regards,
dan carpenter

#1 lore raw

Hi

Quoted 8 lines · Dan Carpenter

Hello Kuppuswamy Sathyanarayanan,

The patch 7ac702b3144b: "iio: ltr501: Add interrupt support" from Apr 19, 2015, leads to the following static checker warning:

	drivers/iio/light/ltr501.c:869 ltr501_write_thresh()
	info: ignoring unreachable code.
Quoted 7 lines

drivers/iio/light/ltr501.c
867 case IIO_PROXIMITY:
868 switch (dir) {
869 if (val > LTR501_PS_THRESH_MASK)
870 return -EINVAL;

Probably this code should be outside of this switch (dir) statement?

Agreed. I will send a patch with fix soon.

Quoted 32 lines
    871                  case IIO_EV_DIR_RISING:
    872                          mutex_lock(&data->lock_ps);
    873                          ret = regmap_bulk_write(data->regmap,
    874                                                  LTR501_PS_THRESH_UP,
    875                                                  &val, 2);
    876                          mutex_unlock(&data->lock_ps);
    877                          return ret;
    878                  case IIO_EV_DIR_FALLING:
    879                          mutex_lock(&data->lock_ps);
    880                          ret = regmap_bulk_write(data->regmap,
    881                                                  LTR501_PS_THRESH_LOW,
    882                                                  &val, 2);
    883                          mutex_unlock(&data->lock_ps);
    884                          return ret;
    885                  default:
    886                          return -EINVAL;
    887                  }
    888          default:
    889                  return -EINVAL;
    890          }
    891
    892          return -EINVAL;
    893  }

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 2 lines
Sathyanarayanan Kuppuswamy
Android kernel developer