summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2018-08-03 13:38:45 +0200
committerTom Rini <trini@konsulko.com>2018-09-10 20:20:34 -0400
commit555e378ca7658e817986e18e4a3f214a7fac60ad (patch)
treefd5ed7fbde3a5c8881a6f678a39254dfbaf2b7c5
parent273a12526c6b6278a79f1bdf7f6cc50a32938b28 (diff)
cli: handle getch error
Handle getch error (when getch return 0x0) to avoid display issue in the console. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
-rw-r--r--common/cli_readline.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/cli_readline.c b/common/cli_readline.c
index 60a232b065..99b631720e 100644
--- a/common/cli_readline.c
+++ b/common/cli_readline.c
@@ -273,6 +273,10 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len,
ichar = getcmd_getch();
+ /* ichar=0x0 when error occurs in U-Boot getc */
+ if (!ichar)
+ continue;
+
if ((ichar == '\n') || (ichar == '\r')) {
putc('\n');
break;