Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: light: apds9306: Fix error handing
@ 2024-06-25 21:02 Mudit Sharma
  2024-06-26 12:10 ` Subhajit Ghosh
  0 siblings, 1 reply; 3+ messages in thread
From: Mudit Sharma @ 2024-06-25 21:02 UTC (permalink / raw)
  To: jic23, lars, subhajit.ghosh, dan.carpenter; +Cc: Mudit Sharma, linux-iio

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>
---
 drivers/iio/light/apds9306.c | 4 ++--
 1 file 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;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-29 17:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-25 21:02 [PATCH] iio: light: apds9306: Fix error handing Mudit Sharma
2024-06-26 12:10 ` Subhajit Ghosh
2024-06-29 17:52   ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox