]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
boot: Only run global bootmeths once each
authorSimon Glass <sjg@chromium.org>
Wed, 15 Oct 2025 15:44:10 +0000 (16:44 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 22 Oct 2025 20:16:56 +0000 (14:16 -0600)
Use the methods_done flags to make sure that each global bootmeth is
only used once. For now this has no effect, since they are all processed
at the start.

Signed-off-by: Simon Glass <sjg@chromium.org>
boot/bootflow.c

index 73deba24d307f939d5e88d9245019df3f4e6bfb7..ca1fe741bab8c33174e30f580de164ad9e123a72 100644 (file)
@@ -294,7 +294,13 @@ static int iter_incr(struct bootflow_iter *iter)
                return BF_NO_MORE_DEVICES;
 
        /* Get the next boothmethod */
-       if (++iter->cur_method < iter->num_methods) {
+       for (iter->cur_method++; iter->cur_method < iter->num_methods;
+            iter->cur_method++) {
+               /* loop until we find a global bootmeth we haven't used */
+               if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && iter->doing_global &&
+                   !bootmeth_glob_allowed(iter, iter->cur_method))
+                       continue;
+
                iter->method = iter->method_order[iter->cur_method];
                return 0;
        }