u8 index;\r
u8 temp =0;\r
point_data[0] = READ_COOR_ADDR; //read coor address\r
-\r
\r
+ if(!ts||!info_buf)\r
+ {\r
+ printk("goodix ts or info_buf is null\n");\r
+ return;\r
+ }\r
+\r
ret=goodix_i2c_read_bytes(ts->client, point_data, sizeof(point_data)/sizeof(point_data[0]));\r
if(ret != 2) \r
{\r
static void rk_ts_work_func(struct work_struct *pwork)\r
{ \r
int i =0;\r
- //struct rk_touch_info *info_buf;\r
char point_num;\r
struct rk_ts_data *ts = container_of(to_delayed_work(pwork), struct rk_ts_data, ts_work);\r
+\r
if(!ts)\r
{\r
printk("container of rk_ts_data fail\n");\r
+ return;\r
+ }\r
+ if(!info_buf)\r
+ {\r
+ printk("info_buf fail\n");\r
+ return;\r
}\r
- \r
-// info_buf= kzalloc(ts->max_touch_num*sizeof(struct rk_touch_info), GFP_KERNEL);\r
-// if(!info_buf)\r
- //{\r
-// printk(KERN_ALERT "alloc for rk_touch_info fail\n");\r
-// goto exit;\r
- //}\r
\r
if(ts->get_touch_info)\r
{\r
ts->early_suspend.resume = rk_ts_late_resume;\r
register_early_suspend(&ts->early_suspend);\r
#endif\r
- \r
+\r
+ info_buf= kzalloc(ts->max_touch_num*sizeof(struct rk_touch_info), GFP_KERNEL);\r
+ if(!info_buf)\r
+ {\r
+ printk(KERN_ALERT "alloc for rk_touch_info fail\n");\r
+ goto err_input_register_device_failed;\r
+ }\r
+\r
ts->irq=gpio_to_irq(ts->irq_pin) ; //If not defined in client\r
if (ts->irq)\r
{\r
goto err_input_register_device_failed;\r
}\r
}\r
-\r
- info_buf= kzalloc(ts->max_touch_num*sizeof(struct rk_touch_info), GFP_KERNEL);\r
- if(!info_buf)\r
- {\r
- printk(KERN_ALERT "alloc for rk_touch_info fail\n");\r
- goto err_input_register_device_failed;\r
- }\r
printk("Goodix TS probe successfully!\n");\r
return 0;\r
\r
dev_notice(&client->dev,"The driver is removing...\n");\r
i2c_set_clientdata(client, NULL);\r
input_unregister_device(ts->input_dev);\r
+ if(info_buf)\r
+ kfree(info_buf);\r
kfree(ts);\r
return 0;\r
}\r