Skip to contentSkip to conversation

iio: chemical: vz89x: correct xfer return value

PATCH In review Matt Ranostay 2 participants 2 messages Dec 27, 2015 – Jan 3, 2016 IIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: chemical: vz89x: correct xfer return value

vz89x_i2c_xfer() function was never returning a non-positive value on error, and this patch corrects that with a -EIO return code.

Also the error condition was incorrect since it was against measurement size and not the i2c messages send/received count.

---
 drivers/iio/chemical/vz89x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/chemical/vz89x.c +1 -1
index c3367aa..0666919 100644
@@ -120,7 +120,7 @@ static int vz89x_i2c_xfer(struct vz89x_data *data, u8 cmd)
 
 	ret = i2c_transfer(client->adapter, msg, 2);
 
-	return (ret == VZ89X_REG_MEASUREMENT_SIZE) ? 0 : ret;
+	return (ret == 2) ? 0 : -EIO;
 }
 
 static int vz89x_smbus_xfer(struct vz89x_data *data, u8 cmd)
Signature · 1 line
2.6.4
maintainer
#1 lore raw
Quoted 7 lines · Matt Ranostay

vz89x_i2c_xfer() function was never returning a non-positive value on error, and this patch corrects that with a -EIO return code.

Also the error condition was incorrect since it was against measurement size and not the i2c messages send/received count.

This doesn't apply to the current tree as we already have
an 'incorrect' fix in place for the value being compared against below.

J

Quoted 18 lines
---
 drivers/iio/chemical/vz89x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/chemical/vz89x.c +1 -1
index c3367aa..0666919 100644
@@ -120,7 +120,7 @@ static int vz89x_i2c_xfer(struct vz89x_data *data, u8 cmd)
 
 	ret = i2c_transfer(client->adapter, msg, 2);
 
-	return (ret == VZ89X_REG_MEASUREMENT_SIZE) ? 0 : ret;
+	return (ret == 2) ? 0 : -EIO;
 }
 
 static int vz89x_smbus_xfer(struct vz89x_data *data, u8 cmd)