discover: Initialise strtok_r saveptr to NULL
[petitboot] / discover / platform-powerpc.c
index 0440eb4d5d0e78a03e67f3f3d2ae6076bd40c2d5..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)) {
@@ -832,11 +832,11 @@ static int save_config(struct platform *p, struct config *config)
        return rc;
 }
 
-static void finalise_config(struct platform *p, const struct config *config)
+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);
 }
 
@@ -905,7 +905,7 @@ static struct platform platform_powerpc = {
        .probe                  = probe,
        .load_config            = load_config,
        .save_config            = save_config,
-       .finalise_config        = finalise_config,
+       .pre_boot               = pre_boot,
        .get_sysinfo            = get_sysinfo,
 };