diff options
author | 2024-06-25 22:02:01 +0100 | |
---|---|---|
committer | 2024-06-29 18:51:25 +0100 | |
commit | 1a5cba43096c9242fab503a40b053ec6b93d313a (patch) | |
tree | d1131408e45928333c613c921b8f841bc7427d01 | |
parent | iio: trigger: Fix condition for own trigger (diff) | |
download | wireguard-linux-1a5cba43096c9242fab503a40b053ec6b93d313a.tar.xz wireguard-linux-1a5cba43096c9242fab503a40b053ec6b93d313a.zip |
iio: light: apds9306: Fix error handing
The return value of 'iio_gts_find_int_time_by_sel()' is assigned to
variable 'intg_old' but value of 'ret' is checked for error. Update to
use 'intg_old' for error checking.
Fixes: 620d1e6c7a3f ("iio: light: Add support for APDS9306 Light Sensor")
Signed-off-by: Mudit Sharma <muditsharma.info@gmail.com>
Reviewed-by: Subhajit Ghosh <subhajit.ghosh@tweaklogic.com>
Link: https://patch.msgid.link/20240625210203.522179-1-muditsharma.info@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-rw-r--r-- | drivers/iio/light/apds9306.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/iio/light/apds9306.c b/drivers/iio/light/apds9306.c index d6627b3e6000..66a063ea3db4 100644 --- a/drivers/iio/light/apds9306.c +++ b/drivers/iio/light/apds9306.c @@ -583,8 +583,8 @@ static int apds9306_intg_time_set(struct apds9306_data *data, int val2) return ret; intg_old = iio_gts_find_int_time_by_sel(&data->gts, intg_time_idx); - if (ret < 0) - return ret; + if (intg_old < 0) + return intg_old; if (intg_old == val2) return 0; |