discover: Initialise strtok_r saveptr to NULL
[petitboot] / discover / platform-powerpc.c
index f6a78a9e52a276dc847f1401173d3ffe5b99afbb..a293ce9dd5506a0c03d000e0c1ba55d8d8e2ff51 100644 (file)
@@ -337,7 +337,7 @@ out_err:
 static int parse_one_dns_config(struct config *config,
                char *confstr)
 {
-       char *tok, *saveptr;
+       char *tok, *saveptr = NULL;
 
        for (tok = strtok_r(confstr, ",", &saveptr); tok;
                        tok = strtok_r(NULL, ",", &saveptr)) {
@@ -836,7 +836,7 @@ static void pre_boot(struct platform *p, const struct config *config)
 {
        struct platform_powerpc *platform = to_platform_powerpc(p);
 
-       if (config->ipmi_bootdev_persistent && platform->clear_ipmi_bootdev)
+       if (!config->ipmi_bootdev_persistent && platform->clear_ipmi_bootdev)
                platform->clear_ipmi_bootdev(platform);
 }