Linux IIO development
 help / color / mirror / Atom feed
From: Mudit Sharma <muditsharma.info@gmail.com>
To: jic23@kernel.org, lars@metafoo.de, subhajit.ghosh@tweaklogic.com,
	dan.carpenter@linaro.org
Cc: Mudit Sharma <muditsharma.info@gmail.com>, linux-iio@vger.kernel.org
Subject: [PATCH] iio: light: apds9306: Fix error handing
Date: Tue, 25 Jun 2024 22:02:01 +0100	[thread overview]
Message-ID: <20240625210203.522179-1-muditsharma.info@gmail.com> (raw)

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


             reply	other threads:[~2024-06-25 21:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 21:02 Mudit Sharma [this message]
2024-06-26 12:10 ` [PATCH] iio: light: apds9306: Fix error handing Subhajit Ghosh
2024-06-29 17:52   ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240625210203.522179-1-muditsharma.info@gmail.com \
    --to=muditsharma.info@gmail.com \
    --cc=dan.carpenter@linaro.org \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=subhajit.ghosh@tweaklogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox