From 57e881dedcd136ca6e15716d7c7348338a7953ca Mon Sep 17 00:00:00 2001 From: Anatol Pomazau Date: Fri, 10 Apr 2015 23:10:19 -0700 Subject: [PATCH] futility: Initialize stack variables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This suppresses following 'maybe-uninitialized' gcc 4.9.2 errors: CC futility/futility.o futility/futility.c: In function ‘do_help’: futility/futility.c:262:2: error: ‘vstr’ may be used uninitialized in this function [-Werror=maybe-uninitialized] printf("The following %scommands are built-in:\n\n", vstr); ^ cc1: all warnings being treated as errors host/lib21/host_misc.c: In function ‘vb2_str_to_id’: host/lib21/host_misc.c:154:14: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized] id->raw[i] = val; ^ cc1: all warnings being treated as errors BUG=none BRANCH=none TEST=compile, run unit tests Change-Id: I6b9d19f2d6e9deb2010dd22602d2a3310f4db335 Signed-off-by: Anatol Pomazau Reviewed-on: https://chromium-review.googlesource.com/265370 Reviewed-by: Bill Richardson Commit-Queue: Anatol Pomazau Tested-by: Anatol Pomazau --- futility/futility.c | 2 +- host/lib21/host_misc.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/futility/futility.c b/futility/futility.c index 60cc9c5662..6cea681442 100644 --- a/futility/futility.c +++ b/futility/futility.c @@ -230,7 +230,7 @@ static int run_command(const struct futil_cmd_t *cmd, int argc, char *argv[]) static int do_help(int argc, char *argv[]) { const struct futil_cmd_t *cmd; - const char *vstr; + const char *vstr = ""; /* Help about a known command? */ if (argc > 1) { diff --git a/host/lib21/host_misc.c b/host/lib21/host_misc.c index db5e8243f0..ee9426a675 100644 --- a/host/lib21/host_misc.c +++ b/host/lib21/host_misc.c @@ -138,7 +138,7 @@ static const char *onebyte(const char *str, uint8_t *vptr) int vb2_str_to_id(const char *str, struct vb2_id *id) { - uint8_t val; + uint8_t val = 0; int i; if (!str)