summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Roth <martinroth@google.com>2018-01-28 15:12:05 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-03-12 19:57:56 +0000
commitc341f1885cd8a9e9eb14217929adc91c01b998e1 (patch)
tree33de566d8c26a80a140fcf3879b8a5dcde4c34db
parent70e5d34a7d6c847a72d37e68d8809c528cd12894 (diff)
downloadchrome-ec-c341f1885cd8a9e9eb14217929adc91c01b998e1.tar.gz
cbi-util: Help GCC determine that variable is initialized
GCC 6.3 can't tell that we enforce the variable 'size' being set, so initialize it to 0 to make the warning go away. The code does actually verify that size is set, but not by checking the size variable itself. util/cbi-util.c: In function 'main': util/cbi-util.c:139:8: error: 'size' may be used uninitialized in this function [-Werror=maybe-uninitialized] buf = malloc(size); ^~~~~~~~~~~~ util/cbi-util.c:233:11: note: 'size' was declared here uint32_t size; ^~~~ BUG=b:72609872 BRANCH=None TEST=Build with coreboot toolchain. Change-Id: Ide41a0fce40254f2fa3a8626dec75840a728d967 Signed-off-by: Martin Roth <martinroth@google.com> Reviewed-on: https://chromium-review.googlesource.com/890703 Commit-Ready: Martin Roth <martinroth@chromium.org> Tested-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/929310 Reviewed-by: Martin Roth <martinroth@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--util/cbi-util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/cbi-util.c b/util/cbi-util.c
index e5ad554a03..d8b32c3468 100644
--- a/util/cbi-util.c
+++ b/util/cbi-util.c
@@ -230,7 +230,7 @@ int main(int argc, char **argv)
int mode = OPT_MODE_NONE;
const char *cbi_filename = NULL;
struct board_info bi;
- uint32_t size;
+ uint32_t size = 0;
uint8_t erase = 0xff;
int show_all = 0;
int parse_error = 0;