Browse Source

Input: zforce - remove unnecessary payload data checks

The function zforce_read_packet() reads 2 values (bytes) of payload
header, validates them and then proceeds to read the payload body.
The function stores all these in a u8 buffer.

The PAYLOAD_LENGTH check seems to be trying to detect an overflow error.
However, since we are just reading a u8 value from the buffer, these
checks are unnecessary and we should simply compare against zero.

Signed-off-by: Luis Ortega <luiorpe1@upv.es>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Heiko Stuebner <heiko@sntech.de> - bq Cervantes (imx6sl)
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Luis Ortega 11 years ago
parent
commit
5aee41a60c
1 changed files with 1 additions and 1 deletions
  1. 1 1
      drivers/input/touchscreen/zforce_ts.c

+ 1 - 1
drivers/input/touchscreen/zforce_ts.c

@@ -423,7 +423,7 @@ static int zforce_read_packet(struct zforce_ts *ts, u8 *buf)
 		goto unlock;
 		goto unlock;
 	}
 	}
 
 
-	if (buf[PAYLOAD_LENGTH] <= 0 || buf[PAYLOAD_LENGTH] > 255) {
+	if (buf[PAYLOAD_LENGTH] == 0) {
 		dev_err(&client->dev, "invalid payload length: %d\n",
 		dev_err(&client->dev, "invalid payload length: %d\n",
 			buf[PAYLOAD_LENGTH]);
 			buf[PAYLOAD_LENGTH]);
 		ret = -EIO;
 		ret = -EIO;