summaryrefslogtreecommitdiff
path: root/drivers/iio/light/opt3001.c
diff options
context:
space:
mode:
authorDenys Drozdov <denys.drozdov@toradex.com>2022-01-10 14:19:41 +0200
committerDenys Drozdov <denys.drozdov@toradex.com>2022-01-10 14:19:41 +0200
commitb9b41da981217b17e1e9171a781c65ae8dde1688 (patch)
treea687d6a640218d96f79c186265bdd9fb16c88a28 /drivers/iio/light/opt3001.c
parente99f775ed2f46b225106f0a156116a0080d16740 (diff)
parent4f508aa9dd3bde7a1c5e4e6de72abb8a03fd504a (diff)
Merge tag 'v5.4.155' into HEAD
This is the 5.4.155 stable release
Diffstat (limited to 'drivers/iio/light/opt3001.c')
-rw-r--r--drivers/iio/light/opt3001.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/iio/light/opt3001.c b/drivers/iio/light/opt3001.c
index 92004a2563ea..5588066c8324 100644
--- a/drivers/iio/light/opt3001.c
+++ b/drivers/iio/light/opt3001.c
@@ -275,6 +275,8 @@ static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2)
ret = wait_event_timeout(opt->result_ready_queue,
opt->result_ready,
msecs_to_jiffies(OPT3001_RESULT_READY_LONG));
+ if (ret == 0)
+ return -ETIMEDOUT;
} else {
/* Sleep for result ready time */
timeout = (opt->int_time == OPT3001_INT_TIME_SHORT) ?
@@ -311,9 +313,7 @@ err:
/* Disallow IRQ to access the device while lock is active */
opt->ok_to_ignore_lock = false;
- if (ret == 0)
- return -ETIMEDOUT;
- else if (ret < 0)
+ if (ret < 0)
return ret;
if (opt->use_irq) {