From: Daniel Schwierzeck Date: Fri, 6 Nov 2015 13:15:37 +0000 (+0100) Subject: sandbox: cros_ec: fix uninitialized use of len X-Git-Tag: v2016.01-rc2~203 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3f51a772d4b7dccc2d379762a03535408b602e54;p=u-boot 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: Daniel Schwierzeck Acked-by: Simon Glass --- diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c index 7509612fb8..98f19a68bf 100644 --- a/drivers/misc/cros_ec_sandbox.c +++ b/drivers/misc/cros_ec_sandbox.c @@ -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);