touchscreen: goodix_gt9xx: fix coverity warning

PD#172713: touchscreen: goodix_gt9xx: fix coverity warning

1.The return value of function "gtp_i2c_read" is not
checked in the "gt9xx.c" file.
2."ts"null pointer dereferencing reference in the "gt9xx.c" file.
3.In the "goodix_tool.c" file, because the third argument to
"memset" function is of type int, expression "cmd_head.data_len + 1"
is of type u16, so it need to convert to int.
This causes "Unused value".

Change-Id: I85ae8d9c11da0ed5d0ffbef97ad4b6c89fd78cf3
Signed-off-by: Yingyuan Zhu <yingyuan.zhu@amlogic.com>
This commit is contained in:
Yingyuan Zhu
2018-08-29 19:38:09 +08:00
committed by Jianxin Pan
parent 8852c2a272
commit a2ab293b58
2 changed files with 11 additions and 3 deletions

View File

@@ -487,7 +487,7 @@ ssize_t goodix_tool_write(struct file *filp, const char __user *buff, size_t len
{
show_len = 0;
total_len = 0;
memset(cmd_head.data, 0, cmd_head.data_len + 1);
memset(cmd_head.data, 0, (int)(cmd_head.data_len + 1));
memcpy(cmd_head.data, &buff[CMD_HEAD_LENGTH], cmd_head.data_len);
if (FAIL == gup_update_proc((void*)cmd_head.data))

View File

@@ -754,6 +754,11 @@ static void goodix_ts_work_func(struct work_struct *work)
u8 buf[8 * GTP_MAX_TOUCH] = {(GTP_READ_COOR_ADDR + 10) >> 8, (GTP_READ_COOR_ADDR + 10) & 0xff};
ret = gtp_i2c_read(ts->client, buf, 2 + 8 * (touch_num - 1));
if (ret < 0)
{
GTP_ERROR("GTP read data from i2c slave device failed");
return;
}
memcpy(&point_data[12], &buf[2], 8 * (touch_num - 1));
}
@@ -2633,8 +2638,11 @@ static int goodix_ts_remove(struct i2c_client *client)
GTP_INFO("GTP driver removing...");
i2c_set_clientdata(client, NULL);
input_unregister_device(ts->input_dev);
kfree(ts);
if (ts)
{
input_unregister_device(ts->input_dev);
kfree(ts);
}
if (goodix_wq)
destroy_workqueue(goodix_wq);