[PATCH] iio: pressure: hsc030pa: Fix i2c_transfer return value check

From: Antoniu Miclaus

Date: Thu Jan 29 2026 - 10:03:23 EST


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@xxxxxxxxxx>
---
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