mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
iio: light: opt4001: Reject integration times with a non-zero seconds part
opt4001_write_raw() only looks at val2 when setting the integration
time, so a write such as 1.000600 is silently accepted as 600 us.
Return -EINVAL if val is non-zero.
Fixes: 9a96084182 ("iio: light: Add support for TI OPT4001 light sensor")
Signed-off-by: Nikhil Gautam <nikhilgtr@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
This commit is contained in:
parent
afa28741c9
commit
d0f21621f8
|
|
@ -269,6 +269,9 @@ static int opt4001_write_raw(struct iio_dev *indio_dev,
|
|||
|
||||
switch (mask) {
|
||||
case IIO_CHAN_INFO_INT_TIME:
|
||||
if (val)
|
||||
return -EINVAL;
|
||||
|
||||
int_time = opt4001_als_time_to_index(val2);
|
||||
if (int_time < 0)
|
||||
return int_time;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user