[PATCH 45/52] expo: Adjust expo_poll() to avoid looping forever

Simon Glass sjg at chromium.org
Wed Mar 19 15:54:50 CET 2025


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 at chromium.org>
---

 boot/expo.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/boot/expo.c b/boot/expo.c
index 4e855f60d84..bf2f1dfc68a 100644
--- a/boot/expo.c
+++ b/boot/expo.c
@@ -324,12 +324,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);
 		}
-- 
2.43.0



More information about the U-Boot mailing list