touchscreen: goodix_gt1x: fix coverity warning
authorYingyuan Zhu <yingyuan.zhu@amlogic.com>
Wed, 29 Aug 2018 10:44:34 +0000 (18:44 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Wed, 5 Sep 2018 15:37:46 +0000 (08:37 -0700)
PD#172714: touchscreen: goodix_gt1x: fix coverity warning

The value of "ret" variable is overridden by
the new value before it is used.
This causes "Unused value".

Change-Id: Ie48b58668c4f4077606d69d5bafbd8d59264ae7e
Signed-off-by: Yingyuan Zhu <yingyuan.zhu@amlogic.com>
drivers/amlogic/input/touchscreen/goodix_gt1x/gt1x.c

index 509b716..c2c8e5e 100644 (file)
@@ -398,7 +398,7 @@ static s32 gt1x_request_io_port(void)
        ret = gpio_request(GTP_INT_PORT, "GTP_INT_IRQ");
        if (ret < 0) {
                GTP_ERROR("Failed to request GPIO:%d, ERRNO:%d", (s32) GTP_INT_PORT, ret);
-               ret = -ENODEV;
+               return -ENODEV;
        } else {
                GTP_GPIO_AS_INT(GTP_INT_PORT);
                gt1x_i2c_client->irq = GTP_INT_IRQ;
@@ -407,14 +407,11 @@ static s32 gt1x_request_io_port(void)
        ret = gpio_request(GTP_RST_PORT, "GTP_RST_PORT");
        if (ret < 0) {
                GTP_ERROR("Failed to request GPIO:%d, ERRNO:%d", (s32) GTP_RST_PORT, ret);
-               ret = -ENODEV;
+               gpio_free(GTP_INT_PORT);
+               return -ENODEV;
        }
 
        GTP_GPIO_AS_INPUT(GTP_RST_PORT);
-       if (ret < 0) {
-               gpio_free(GTP_RST_PORT);
-               gpio_free(GTP_INT_PORT);
-       }
 
        return ret;
 }