Skip to content
Commit 288320f6 authored by Colin Ian King's avatar Colin Ian King Committed by Jonathan Cameron
Browse files

iio: tsl2x7x/tsl2772: avoid potential division by zero



It may be possible for tsl2772_get_lux to return a zero lux value
and hence a division by zero can occur when lux_val is zero. Check
for this case and return -ERANGE to avoid the division by zero.

Detected by CoverityScan, CID#1469484 ("Division or modulo by zero")

Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarBrian Masney <masneyb@onstation.org>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 13399ff2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment