Anastasia Klimchuk submitted this change.
cli_classic: Defer flashrom_init calibration until after options parsing
flashrom_init() may run through an expensive delay calibration phase,
depending on the system timer behavior (e.g., if high resolution timers
are disabled). This is wholly unnecessary if we're only going to dump
usage output or similar.
Defer the calibration until we've finished our CLI overhead.
BUG=b:325539928
TEST=`flashrom --help` with `sysctl kernel.timer_highres` == 0
Change-Id: I57949ab511df04c6922008fa8cb12467154e2c5e
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/80772
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Hsuan-ting Chen <roccochen@google.com>
Reviewed-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
---
M cli_classic.c
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/cli_classic.c b/cli_classic.c
index 60f3fd5..ffded5f 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -917,10 +917,6 @@
print_version();
print_banner();
- /* FIXME: Delay calibration should happen in programmer code. */
- if (flashrom_init(1))
- exit(1);
-
setbuf(stdout, NULL);
parse_options(argc, argv, optstring, long_options, &options);
@@ -1005,6 +1001,10 @@
}
}
+ /* FIXME: Delay calibration should happen in programmer code. */
+ if (flashrom_init(1))
+ exit(1);
+
if (programmer_init(options.prog, options.pparam)) {
msg_perr("Error: Programmer initialization failed.\n");
ret = 1;
To view, visit change 80772. To unsubscribe, or for help writing mail filters, visit settings.