mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Antoniu Miclaus <antoniu.miclaus@analog.com>
To: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Petre Rodan" <petre.rodan@subdimension.ro>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Manuel Stahl" <manuel.stahl@iis.fraunhofer.de>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] iio: pressure: hsc030pa: Fix i2c_transfer return value check
Date: Thu, 29 Jan 2026 17:01:46 +0200	[thread overview]
Message-ID: <20260129150151.127713-2-antoniu.miclaus@analog.com> (raw)
In-Reply-To: <20260129150151.127713-1-antoniu.miclaus@analog.com>

The i2c_transfer() function returns the number of messages
successfully transferred. The function sends 1 message but checks
for ret == 2, which can never be true. This causes the function to
always return an error (1) instead of success (0).

Fix the check to compare against the actual number of messages sent.

Fixes: 6362d96585e3 ("iio: pressure: driver for Honeywell HSC/SSC series")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
 drivers/iio/pressure/hsc030pa_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/pressure/hsc030pa_i2c.c b/drivers/iio/pressure/hsc030pa_i2c.c
index a34ef4653f34..e780732c7b75 100644
--- a/drivers/iio/pressure/hsc030pa_i2c.c
+++ b/drivers/iio/pressure/hsc030pa_i2c.c
@@ -35,7 +35,7 @@ static int hsc_i2c_recv(struct hsc_data *data)
 
 	ret = i2c_transfer(client->adapter, &msg, 1);
 
-	return (ret == 2) ? 0 : ret;
+	return (ret == 1) ? 0 : ret;
 }
 
 static int hsc_i2c_probe(struct i2c_client *client)
-- 
2.43.0


  reply	other threads:[~2026-01-29 15:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29 15:01 [PATCH] iio: gyro: itg3200: Fix unchecked return value in read_raw Antoniu Miclaus
2026-01-29 15:01 ` Antoniu Miclaus [this message]
2026-01-29 15:54   ` [PATCH] iio: pressure: hsc030pa: Fix i2c_transfer return value check Andy Shevchenko
2026-01-29 17:06   ` Jonathan Cameron
2026-01-29 15:53 ` [PATCH] iio: gyro: itg3200: Fix unchecked return value in read_raw Andy Shevchenko
2026-01-29 17:07   ` 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=20260129150151.127713-2-antoniu.miclaus@analog.com \
    --to=antoniu.miclaus@analog.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manuel.stahl@iis.fraunhofer.de \
    --cc=nuno.sa@analog.com \
    --cc=petre.rodan@subdimension.ro \
    /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

all inboxes | Powered by JetHome®