touchscreen: goodix_gt1x: fix coverity warning

PD#172714: touchscreen: goodix_gt1x: fix coverity warning

1.The return value of the function "gt1x_i2c_read" is not
checked in the "gt1x_generic.c" file.
2.There is no exit condition for the "while (retry > 0)"
loop statement in the "gt1x_update.c" file.
This causes "Untrusted valued as argument" and "Logically dead code".

Change-Id: I07c0639d084ca3b961dd187ce6721f0167b2e4cc
Signed-off-by: Yingyuan Zhu <yingyuan.zhu@amlogic.com>
This commit is contained in:
Yingyuan Zhu
2018-08-29 19:07:23 +08:00
committed by Jianxin Pan
parent 3ff706aea4
commit 35a6b7fa1d
2 changed files with 5 additions and 2 deletions

View File

@@ -106,7 +106,7 @@ static ssize_t gt1x_debug_read_proc(struct file *file, char __user * page, size_
{
char *ptr = page;
char temp_data[GTP_CONFIG_MAX_LENGTH] = { 0 };
int i;
int i, ret = -1;
if (*ppos) {
return 0;
@@ -136,7 +136,9 @@ static ssize_t gt1x_debug_read_proc(struct file *file, char __user * page, size_
/* Touch PID & VID */
ptr += sprintf(ptr, "==== GT1X Version Info ====\n");
gt1x_i2c_read(GTP_REG_VERSION, temp_data, 12);
ret = gt1x_i2c_read(GTP_REG_VERSION, temp_data, 12);
if (ret < 0)
return ret;
ptr += sprintf(ptr, "ProductID: GT%c%c%c%c\n", temp_data[0], temp_data[1], temp_data[2], temp_data[3]);
ptr += sprintf(ptr, "PatchID: %02X%02X\n", temp_data[4], temp_data[5]);
ptr += sprintf(ptr, "MaskID: %02X%02X\n", temp_data[7], temp_data[8]);

View File

@@ -515,6 +515,7 @@ int gt1x_update_prepare(char *filename)
retry = 5;
while (retry > 0) {
retry--;
update_info.buffer = (u8 *) kzalloc(1024 * 4, GFP_KERNEL);
if (update_info.buffer == NULL) {
GTP_ERROR("Alloc %d bytes memory fail.", 1024 * 4);