mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 20:07:46 +09:00
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:
committed by
Jianxin Pan
parent
3ff706aea4
commit
35a6b7fa1d
@@ -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]);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user