Skip to contentSkip to conversation

input: cy8ctmg100_ts: signedness bug

PATCH In review Dan Carpenter 3 participants 4 messages Aug 6, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 input: cy8ctmg100_ts: signedness bug

"ret" should be signed here or the error handling doesn't work.

drivers/input/touchscreen/cy8ctmg110_ts.c +1 -1
index 4eb7df0..f4e893f 100644
@@ -96,7 +96,7 @@ static int cy8ctmg110_read_regs(struct cy8ctmg110 *tsc,
 		unsigned char *data, unsigned char len, unsigned char cmd)
 {
 	struct i2c_client *client = tsc->client;
-	unsigned int ret;
+	int ret;
 	struct i2c_msg msg[2] = {
 		/* first write slave position to i2c devices */
 		{ client->addr, 0, 1, &cmd },
maintainer
#1 lore raw
Quoted 9 lines · Dan Carpenter

"ret" should be signed here or the error handling doesn't work.

drivers/input/touchscreen/cy8ctmg110_ts.c +0 -0
index 4eb7df0..f4e893f 100644

drivers/input/touchscreen/cy8ctmg110_ts.c static int cy8ctmg110_read_regs(struct cy8ctmg110 *tsc, · line 102

Quoted 8 lines
drivers/input/touchscreen/cy8ctmg110_ts.c +1 -1
@@ -96,7 +96,7 @@ static int cy8ctmg110_read_regs(struct cy8ctmg110 *tsc,
 		unsigned char *data, unsigned char len, unsigned char cmd)
 {
 	struct i2c_client *client = tsc->client;
-	unsigned int ret;
+	int ret;
 	struct i2c_msg msg[2] = {
 		/* first write slave position to i2c devices */
 		{ client->addr, 0, 1, &cmd },

Thanks Dan. It looks like cy8ctmg110_write_regs has siilar issue. Do you thiks the following will work?

Thanks.

Signature · 14 lines
Dmitry

Input: cy8ctmg100_ts - signedness bug

From: Dan Carpenter <[email protected]>

"ret" should be signed here or the error handling doesn't work.

Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
---

 drivers/input/touchscreen/cy8ctmg110_ts.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/input/touchscreen/cy8ctmg110_ts.c +3 -3
index 4eb7df0..5ec0946 100644
@@ -75,7 +75,7 @@ static int cy8ctmg110_write_regs(struct cy8ctmg110 *tsc, unsigned char reg,
 		unsigned char len, unsigned char *value)
 {
 	struct i2c_client *client = tsc->client;
-	unsigned int ret;
+	int ret;
 	unsigned char i2c_data[6];
 
 	BUG_ON(len > 5);
@@ -86,7 +86,7 @@ static int cy8ctmg110_write_regs(struct cy8ctmg110 *tsc, unsigned char reg,
 	ret = i2c_master_send(client, i2c_data, len + 1);
 	if (ret != 1) {
 		dev_err(&client->dev, "i2c write data cmd failed\n");
-		return ret;
+		return ret ? ret : -EIO;
 	}
 
 	return 0;
@@ -96,7 +96,7 @@ static int cy8ctmg110_read_regs(struct cy8ctmg110 *tsc,
 		unsigned char *data, unsigned char len, unsigned char cmd)
 {
 	struct i2c_client *client = tsc->client;
-	unsigned int ret;
+	int ret;
 	struct i2c_msg msg[2] = {
 		/* first write slave position to i2c devices */
 		{ client->addr, 0, 1, &cmd },
#2 lore raw
Quoted 6 lines · Dmitry Torokhov

Thanks Dan. It looks like cy8ctmg110_write_regs has siilar issue. Do you thiks the following will work?

Thanks.

Ah right. That should be signed as well. Thanks.

regards,
dan carpenter