summaryrefslogtreecommitdiff
path: root/drivers/iio/light
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-02 09:21:54 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-02 09:21:54 +0300
commit7f5d8f711687fb6ad39ece9dd8e76dc6b196ac5c (patch)
treef11fd2349981d5c86cfcaf11029946d18cdcb5f7 /drivers/iio/light
parenta98a5c27b54e01dd9c42e2b0addb543f0dc494cd (diff)
parent021c91791a5e7e85c567452f1be3e4c2c6cb6063 (diff)
downloadlinux-7f5d8f711687fb6ad39ece9dd8e76dc6b196ac5c.tar.xz
Merge 4.18-rc3 into staging-next
We want the staging/iio fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/iio/light')
-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;