]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
expo: Adjust expo_poll() to avoid looping forever
authorSimon Glass <sjg@chromium.org>
Fri, 2 May 2025 14:46:51 +0000 (08:46 -0600)
committerSimon Glass <sjg@chromium.org>
Fri, 30 May 2025 08:49:32 +0000 (09:49 +0100)
If the user does not quickly provide some input, exit so that other
things can be done, such as searching for the next OS.

Signed-off-by: Simon Glass <sjg@chromium.org>
boot/expo.c

index 7dbcac78c2287403fe831c18abeb5aa5fadce9a2..ee8ffaf89204dba69fd6cb8b642b9e73ae7d9356 100644 (file)
@@ -326,12 +326,14 @@ int expo_poll(struct expo *exp, struct expo_action *act)
 
        ichar = cli_ch_process(&exp->cch, 0);
        if (!ichar) {
-               while (!ichar && !tstc()) {
+               int i;
+
+               for (i = 0; i < 10 && !ichar && !tstc(); i++) {
                        schedule();
                        mdelay(2);
                        ichar = cli_ch_process(&exp->cch, -ETIMEDOUT);
                }
-               if (!ichar) {
+               while (!ichar && tstc()) {
                        ichar = getchar();
                        ichar = cli_ch_process(&exp->cch, ichar);
                }