浏览代码

Input: cyapa - fix variable being dereferenced before check

Fixes the warning regarding variable being dereferenced before check
'gen5_pip->resp_len'.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Dudley Du <dudl@cypress.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Dudley Du 10 年之前
父节点
当前提交
a535a9f16c
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      drivers/input/mouse/cyapa_gen5.c

+ 3 - 1
drivers/input/mouse/cyapa_gen5.c

@@ -2557,7 +2557,9 @@ static bool cyapa_gen5_irq_cmd_handler(struct cyapa *cyapa)
 			 * trackpad device when booting/rebooting
 			 * their chrome book.
 			 */
-			length = *gen5_pip->resp_len;
+			length = 0;
+			if (gen5_pip->resp_len)
+				length = *gen5_pip->resp_len;
 			cyapa_empty_pip_output_data(cyapa,
 					gen5_pip->resp_data,
 					&length,