From: Jeremy Kerr Date: Fri, 11 Apr 2014 08:11:51 +0000 (+0800) Subject: discover: Fix uninitialised var warnings X-Git-Tag: v1.0.0~188 X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=commitdiff_plain;h=cf651e02fb7a34545211708c2a285cd228645531 discover: Fix uninitialised var warnings We get a couple of uninitialised var warning when compiling with certain CFLAGS (-fprofile-arcs -ftest-coverage at this stage). In statement_if_execute: We'll never actually use this uninitialised (as there must be at least one conditional in the parsed statement), but we should address the warning nonetheless. As passed to strtok_r: strtok will initialise this, but it isn't obvious to the compiler. Signed-off-by: Jeremy Kerr --- diff --git a/discover/grub2/script.c b/discover/grub2/script.c index 0618297..36f73b2 100644 --- a/discover/grub2/script.c +++ b/discover/grub2/script.c @@ -309,7 +309,7 @@ int statement_if_execute(struct grub2_script *script, { struct grub2_statement_if *st = to_stmt_if(statement); struct grub2_statement *conditional; - bool executed; + bool executed = false; int rc = 0; list_for_each_entry(&st->conditionals->list, conditional, list) { diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c index d1d4191..28c081d 100644 --- a/discover/platform-powerpc.c +++ b/discover/platform-powerpc.c @@ -344,8 +344,8 @@ static int parse_one_dns_config(struct config *config, static void populate_network_config(struct platform_powerpc *platform, struct config *config) { + char *val, *saveptr = NULL; const char *cval; - char *val; int i; cval = get_param(platform, "petitboot,network"); @@ -355,7 +355,7 @@ static void populate_network_config(struct platform_powerpc *platform, val = talloc_strdup(config, cval); for (i = 0; ; i++) { - char *tok, *saveptr; + char *tok; tok = strtok_r(i == 0 ? val : NULL, " ", &saveptr); if (!tok)