提交 3f51a772 编写于 作者: D Daniel Schwierzeck 提交者: Simon Glass

sandbox: cros_ec: fix uninitialized use of len

Building with gcc-5.2 raises this warning:

drivers/misc/cros_ec_sandbox.c: In function cros_ec_sandbox_packet:
drivers/misc/cros_ec_sandbox.c:483:5: warning: len may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (len < 0)
     ^

If the function process_cmd() is called with
req_hdr->command == EC_CMD_ENTERING_MODE, the value of len will be
returned uninitialized.
Signed-off-by: NDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Acked-by: NSimon Glass <sjg@chromium.org>
上级 b6ff6ce6
......@@ -460,6 +460,7 @@ static int process_cmd(struct ec_state *ec,
len = cros_ec_keyscan(ec, resp_data);
break;
case EC_CMD_ENTERING_MODE:
len = 0;
break;
default:
printf(" ** Unknown EC command %#02x\n", req_hdr->command);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册