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>
This commit is contained in:
Patrick Delaunay 2018-08-03 13:38:45 +02:00 committed by Tom Rini
parent 273a12526c
commit 555e378ca7
1 changed files with 4 additions and 0 deletions

View File

@ -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;