summaryrefslogtreecommitdiffstats
path: root/drivers/iio/light/tsl2772.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/iio/light/tsl2772.c')
-rw-r--r--drivers/iio/light/tsl2772.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/iio/light/tsl2772.c b/drivers/iio/light/tsl2772.c
index 34d42a2504c9..df5b2a0da96c 100644
--- a/drivers/iio/light/tsl2772.c
+++ b/drivers/iio/light/tsl2772.c
@@ -582,6 +582,8 @@ static int tsl2772_als_calibrate(struct iio_dev *indio_dev)
"%s: failed to get lux\n", __func__);
return lux_val;
}
+ if (lux_val == 0)
+ return -ERANGE;
ret = (chip->settings.als_cal_target * chip->settings.als_gain_trim) /
lux_val;