Recovery script uses two variables: a button press time counter (cnt)
and a flag (stop_boot) used later to decide if booting process should be
interrupted.
Clear their values before and after running recovery script as they
could already exist in environment (could be accidentally saved).
gd->flags &= ~(GD_FLG_SILENT);
#endif
+ /*
+ * Always clear values of variables used in recovery script
+ * as they could be accidentally saved before
+ */
+ setenv("stop_boot", NULL);
+ setenv("cnt", NULL);
+
run_command("run recovery", 0);
/* Should we stop booting after recovery mode? */
c = getenv("stop_boot");
stop_boot = c ? (int)simple_strtol(c, NULL, 10) : 0;
- if (stop_boot)
+ if (stop_boot) {
+ setenv("stop_boot", NULL);
bootcmd = NULL;
+ }
+
+ setenv("cnt", NULL);
}
#endif /* CONFIG_RECOVERY_MODE */