Skip to contentSkip to conversation

patch "iio: light: opt4001: Reject integration times with a non-zero seconds" added to char-misc-next

PATCH [email protected] 1 participant 1 message Aug 19

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

iio: light: opt4001: Reject integration times with a non-zero seconds

to my char-misc git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
in the char-misc-next branch.

The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)

The patch will also be merged in the next major kernel release during the merge window.

If you have any questions about this process, please let me know.

From d0f21621f8b2b46661ea066d20705dbf7253db87 Mon Sep 17 00:00:00 2001
From: Nikhil Gautam <[email protected]>
Date: Tue, 14 Jul 2026 17:01:33 +0530
Subject: 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 9a9608418292 ("iio: light: Add support for TI OPT4001 light sensor")
---
 drivers/iio/light/opt4001.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/iio/light/opt4001.c +3 -0
index 944923cb8f28..2448d6330489 100644
@@ -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;
Signature · 1 line
2.55.0