]> git.ozlabs.org Git - petitboot/commitdiff
discover: Fix uninitialised var warnings
authorJeremy Kerr <jk@ozlabs.org>
Fri, 11 Apr 2014 08:11:51 +0000 (16:11 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Wed, 16 Apr 2014 01:08:45 +0000 (09:08 +0800)
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 <jk@ozlabs.org>
discover/grub2/script.c
discover/platform-powerpc.c

index 0618297784499f5d60ac0e597e03ff8602ee05d7..36f73b21abfc4a0992a5a8a5540382d6102581c1 100644 (file)
@@ -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) {
index d1d4191ede7df64f485e75d59e6826237d7525b7..28c081d7540332281e972609f935496141905a21 100644 (file)
@@ -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)