If the client asks for max-download-size, there is no need to enumerate
all partitions, so reorder the code accordingly.

Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de>
---
 common/fastboot.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/common/fastboot.c b/common/fastboot.c
index 3155ff2af92c..231f49c1a6c9 100644
--- a/common/fastboot.c
+++ b/common/fastboot.c
@@ -310,6 +310,16 @@ static void cb_getvar(struct fastboot *fb, const char *cmd)
 {
        LIST_HEAD(partition_list);
        struct file_list_entry *fentry;
+       bool all;
+
+       pr_debug("getvar: \"%s\"\n", cmd);
+
+       all = !strcmp(cmd, "all");
+       if (all)
+               cmd = NULL;
+
+       if (fastboot_tx_print_var(fb, &fb->variables, cmd))
+               goto out;
 
        file_list_for_each_entry(fb->files, fentry) {
                int ret;
@@ -325,19 +335,6 @@ static void cb_getvar(struct fastboot *fb, const char *cmd)
                }
        }
 
-       pr_debug("getvar: \"%s\"\n", cmd);
-
-       if (!strcmp(cmd, "all")) {
-               fastboot_tx_print_var(fb, &fb->variables, NULL);
-               fastboot_tx_print_var(fb, &partition_list, NULL);
-
-               fastboot_tx_print(fb, FASTBOOT_MSG_OKAY, "");
-               goto out;
-       }
-
-       if (fastboot_tx_print_var(fb, &fb->variables, cmd))
-               goto out;
-
        if (fastboot_tx_print_var(fb, &partition_list, cmd))
                goto out;
 
-- 
2.39.5


Reply via email to