Skip to content

Commit 1a5cba4

Browse files
Mudit Sharmajic23
authored andcommitted
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: 620d1e6 ("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>
1 parent 74cb215 commit 1a5cba4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/iio/light/apds9306.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,8 @@ static int apds9306_intg_time_set(struct apds9306_data *data, int val2)
583583
return ret;
584584

585585
intg_old = iio_gts_find_int_time_by_sel(&data->gts, intg_time_idx);
586-
if (ret < 0)
587-
return ret;
586+
if (intg_old < 0)
587+
return intg_old;
588588

589589
if (intg_old == val2)
590590
return 0;

0 commit comments

Comments
 (0)