Ignore null character when waiting for autoboot abort
authorPiotr Dymacz <pepe2k@gmail.com>
Thu, 31 Mar 2016 09:30:35 +0000 (11:30 +0200)
committerPiotr Dymacz <pepe2k@gmail.com>
Thu, 31 Mar 2016 09:30:35 +0000 (11:30 +0200)
u-boot/common/main.c

index 42f3d57d2d37e859b37aa0bb1cfb8cb153063058..6c50e7a0d1113f94048e2d8ebd8be611f7f9f91a 100644 (file)
@@ -58,9 +58,7 @@ static char tab_seq[] = "        "; /* used to expand TABs    */
  */
 #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
 static __inline__ int abortboot(int bootdelay){
-#ifdef CONFIG_AUTOBOOT_STOP_CHAR
        char stopc;
-#endif
        int abort = 0;
 
 #ifdef CONFIG_SILENT_CONSOLE
@@ -85,26 +83,19 @@ static __inline__ int abortboot(int bootdelay){
 
                        /* delay 100 * 10ms */
                        for(i = 0; !abort && i < 100; ++i){
-
                                /* we got a key press   */
                                if(tstc()){
-#ifdef CONFIG_AUTOBOOT_STOP_CHAR
                                        stopc = getc();
+#ifdef CONFIG_AUTOBOOT_STOP_CHAR
                                        if (stopc == CONFIG_AUTOBOOT_STOP_CHAR) {
+#else
+                                       if (stopc != 0) {
+#endif
                                                abort = 1;
                                                bootdelay = 0;
 
                                                break;
                                        }
-#else
-                                       /* don't auto boot      */
-                                       abort = 1;
-                                       /* no more delay        */
-                                       bootdelay = 0;
-                                       /* consume input        */
-                                       (void) getc();
-                                       break;
-#endif /* CONFIG_AUTOBOOT_STOP_CHAR */
                                }
                                udelay(10000);
                        }