Skip to contentSkip to conversation

iio: proximity: lidar: correct 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: proximity: lidar: correct return value

lidar_i2c_xfer() function was never a non-positive value on error, and this correct that with a -EIO return code.

---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +1 -1
index 93e29fb..db35e04 100644
@@ -87,7 +87,7 @@ static int lidar_i2c_xfer(struct lidar_data *data, u8 reg, u8 *val, int len)
 
 	ret = i2c_transfer(client->adapter, msg, 2);
 
-	return (ret == 2) ? 0 : ret;
+	return (ret == 2) ? 0 : -EIO;
 }
 
 static int lidar_smbus_xfer(struct lidar_data *data, u8 reg, u8 *val, int len)
Signature · 1 line
2.6.4
maintainer
#1 lore raw
Quoted 4 lines · Matt Ranostay

lidar_i2c_xfer() function was never a non-positive value on error, and this correct that with a -EIO return code.

Hmm. Awkward timing on this one. I'll create a temporary fix branch for post the merge window closing and send it on to Greg when appropriate.

This patch could have done with a fixes tag to avoid me having to look up when this problem was introduced i.e.

Fixes 366e65633cf4 ("iio: proximity: lidar: optimize i2c transactions")
Quoted 18 lines
---
 drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +1 -1
index 93e29fb..db35e04 100644
@@ -87,7 +87,7 @@ static int lidar_i2c_xfer(struct lidar_data *data, u8 reg, u8 *val, int len)
 
 	ret = i2c_transfer(client->adapter, msg, 2);
 
-	return (ret == 2) ? 0 : ret;
+	return (ret == 2) ? 0 : -EIO;
 }
 
 static int lidar_smbus_xfer(struct lidar_data *data, u8 reg, u8 *val, int len)