[PATCH] Input: ili210x - fix ili251x_read_touch_data() return value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The caller of this function treats all non-zero values as an error, so
the return value of i2c_master_recv() cannot be returned directly.
Follow the same pattern as ili211x_read_touch_data() to return zero when
the correct number of bytes is read and a negative error code otherwise.

This fixes touch reporting when there are more than 6 active touches.

Signed-off-by: John Keeping <jkeeping@xxxxxxxxxxxxxxxxx>
---
 drivers/input/touchscreen/ili210x.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
index 31ffdc2a93f35..8846c6d10fc0d 100644
--- a/drivers/input/touchscreen/ili210x.c
+++ b/drivers/input/touchscreen/ili210x.c
@@ -255,14 +255,15 @@ static int ili251x_read_reg(struct i2c_client *client,
 static int ili251x_read_touch_data(struct i2c_client *client, u8 *data)
 {
 	int error;
+	int ret;
 
 	error = ili251x_read_reg_common(client, REG_TOUCHDATA,
 					data, ILI251X_DATA_SIZE1, 0);
 	if (!error && data[0] == 2) {
-		error = i2c_master_recv(client, data + ILI251X_DATA_SIZE1,
-					ILI251X_DATA_SIZE2);
-		if (error >= 0 && error != ILI251X_DATA_SIZE2)
-			error = -EIO;
+		ret = i2c_master_recv(client, data + ILI251X_DATA_SIZE1,
+				      ILI251X_DATA_SIZE2);
+		if (ret != ILI251X_DATA_SIZE2)
+			error = ret < 0 ? ret : -EIO;
 	}
 
 	return error;
-- 
2.45.1





[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux