]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cli: handle getch error
authorPatrick Delaunay <patrick.delaunay@st.com>
Fri, 3 Aug 2018 11:38:45 +0000 (13:38 +0200)
committerTom Rini <trini@konsulko.com>
Tue, 11 Sep 2018 00:20:34 +0000 (20:20 -0400)
Handle getch error (when getch return 0x0) to avoid display issue
in the console.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
common/cli_readline.c

index 60a232b065e821bd3294f10fa3b39b6daf99ad48..99b631720e17b02fdc41f524d7a733b19bb72750 100644 (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;