]> git.sur5r.net Git - u-boot/blobdiff - lib/efi_loader/efi_console.c
script: Make get_default_envs.sh script exclude tools/env
[u-boot] / lib / efi_loader / efi_console.c
index c09b93d9d68be6c18e17d52be7a6cb24406e5390..ce66c935ecbf7cff0eb019712c465c4cf2a7d2da 100644 (file)
@@ -60,7 +60,15 @@ static struct simple_text_output_mode efi_con_mode = {
        .cursor_visible = 1,
 };
 
-static int term_read_reply(int *n, int maxnum, char end_char)
+/*
+ * Receive and parse a reply from the terminal.
+ *
+ * @n:         array of return values
+ * @num:       number of return values expected
+ * @end_char:  character indicating end of terminal message
+ * @return:    non-zero indicates error
+ */
+static int term_read_reply(int *n, int num, char end_char)
 {
        char c;
        int i = 0;
@@ -77,7 +85,7 @@ static int term_read_reply(int *n, int maxnum, char end_char)
                c = getc();
                if (c == ';') {
                        i++;
-                       if (i >= maxnum)
+                       if (i >= num)
                                return -1;
                        n[i] = 0;
                        continue;
@@ -91,6 +99,8 @@ static int term_read_reply(int *n, int maxnum, char end_char)
                n[i] *= 10;
                n[i] += c - '0';
        }
+       if (i != num - 1)
+               return -1;
 
        return 0;
 }
@@ -213,7 +223,7 @@ static int query_console_serial(int *rows, int *cols)
 static void query_console_size(void)
 {
        const char *stdout_name = env_get("stdout");
-       int rows, cols;
+       int rows = 25, cols = 80;
 
        if (stdout_name && !strcmp(stdout_name, "vidconsole") &&
            IS_ENABLED(CONFIG_DM_VIDEO)) {