At present when one bootmeth fails on the final partition, the next
bootmeth is not tried. Adjust the logic to go to the next bootmeth,
which is the more natural behaviour.

Signed-off-by: Simon Glass <[email protected]>
---

(no changes since v1)

 boot/bootflow.c | 34 ++++++++++++++++------------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/boot/bootflow.c b/boot/bootflow.c
index 8f38a1ab940..2ec05fe5432 100644
--- a/boot/bootflow.c
+++ b/boot/bootflow.c
@@ -195,27 +195,25 @@ static int iter_incr(struct bootflow_iter *iter)
        if (iter->err == BF_NO_MORE_DEVICES)
                return BF_NO_MORE_DEVICES;
 
-       if (iter->err != BF_NO_MORE_PARTS) {
-               /* Get the next boothmethod */
-               if (++iter->cur_method < iter->num_methods) {
-                       iter->method = iter->method_order[iter->cur_method];
-                       return 0;
-               }
+       /* Get the next boothmethod */
+       if (++iter->cur_method < iter->num_methods) {
+               iter->method = iter->method_order[iter->cur_method];
+               return 0;
+       }
+
+       /*
+        * If we have finished scanning the global bootmeths, start the
+        * normal bootdev scan
+        */
+       if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && global) {
+               iter->num_methods = iter->first_glob_method;
+               iter->doing_global = false;
 
                /*
-                * If we have finished scanning the global bootmeths, start the
-                * normal bootdev scan
+                * Don't move to the next dev as we haven't tried this
+                * one yet!
                 */
-               if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL) && global) {
-                       iter->num_methods = iter->first_glob_method;
-                       iter->doing_global = false;
-
-                       /*
-                        * Don't move to the next dev as we haven't tried this
-                        * one yet!
-                        */
-                       inc_dev = false;
-               }
+               inc_dev = false;
        }
 
        if (iter->flags & BOOTFLOWIF_SINGLE_PARTITION)
-- 
2.43.0

Reply via email to