touchscreen: goodix_gt9xx: fix coverity warning
authorYingyuan Zhu <yingyuan.zhu@amlogic.com>
Wed, 29 Aug 2018 11:52:14 +0000 (19:52 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Thu, 6 Sep 2018 14:03:41 +0000 (07:03 -0700)
PD#172713: touchscreen: goodix_gt9xx: fix coverity warning

There is no judgment about whether the pointer
 is NULL before using it.
This causes "Dereference before null check".

Change-Id: Ic4d96cc1e48d16f409b71c70a049b433eeb39bf1
Signed-off-by: Yingyuan Zhu <yingyuan.zhu@amlogic.com>
drivers/amlogic/input/touchscreen/goodix_gt9xx/gt9xx_update.c

index 06f1b0e8bc516b47b479bbf528e25787ec1dfa19..fdcdcc7539b4f4a5d51f575f87fa1d7e146f0a02 100644 (file)
@@ -1013,6 +1013,8 @@ static u8 gup_burn_proc(struct i2c_client *client, u8 *burn_buf, u16 start_addr,
     u8  retry = 0;
 
     GTP_DEBUG("Begin burn %dk data to addr 0x%x", (total_length/1024), start_addr);
+    if (!burn_buf)
+       return FAIL;
     while(burn_length < total_length)
     {
         GTP_DEBUG("B/T:%04d/%04d", burn_length, total_length);