Skip to content

Commit 1401178

Browse files
cjd8gregkh
authored andcommitted
iio: light: opt3001: fix missing state reset on timeout
commit c123ca6 upstream. Currently in the function opt3001_get_processed(), there is a check that directly returns -ETIMEDOUT if the conversion IRQ times out, completely bypassing the err label, leaving ok_to_ignore_lock permanently true, potentially breaking the device's falling threshold interrupt detection. Assign -ETIMEDOUT to the return variable and jump to the error label to ensure ok_to_ignore_lock is properly reset. Fixes: 26d90b5 ("iio: light: opt3001: Fixed timeout error when 0 lux") Reported-by: Sashiko <sashiko-bot@kernel.org> Closes: https://sashiko.dev/#/patchset/20260525-opt3001-cleanup-v4-0-65b36a174f78%40gmail.com?part=1 Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f350883 commit 1401178

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/iio/light/opt3001.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,10 @@ static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2)
280280
ret = wait_event_timeout(opt->result_ready_queue,
281281
opt->result_ready,
282282
msecs_to_jiffies(OPT3001_RESULT_READY_LONG));
283-
if (ret == 0)
284-
return -ETIMEDOUT;
283+
if (ret == 0) {
284+
ret = -ETIMEDOUT;
285+
goto err;
286+
}
285287
} else {
286288
/* Sleep for result ready time */
287289
timeout = (opt->int_time == OPT3001_INT_TIME_SHORT) ?

0 commit comments

Comments
 (0)