When trying all bootdevs in a uclass, the method flags are not preserved
in the iterator.

This has no impact on the first bootdev, since that is the one which
sets the flags. For the next one, iter_inc() is used and it finds the
next bootdev. However it sets the method_flags to 0

The result is that the third scan is conducted without the required
BOOTFLOW_METHF_SINGLE_UCLASS flag, so iteration procees to the next
label. This can miss bootdevs if there three or more USB-storage
devices, for example.

Fix this by keeping the method flags around in this case.

This patch is not quite a bug fix, but a further refinement on top of
this commit:

  7a790f018a8 ("bootstd: Scan all bootdevs in a boot_targets entry (take 2)")

Signed-off-by: Simon Glass <s...@chromium.org>
---

(no changes since v1)

 boot/bootflow.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/boot/bootflow.c b/boot/bootflow.c
index 345dd993c14..76dadb93be1 100644
--- a/boot/bootflow.c
+++ b/boot/bootflow.c
@@ -288,7 +288,8 @@ static int iter_incr(struct bootflow_iter *iter)
                                 * bootdev_find_by_label() where this flag is
                                 * set up
                                 */
-                               if (iter->method_flags &
+                               method_flags = iter->method_flags;
+                               if (method_flags &
                                    BOOTFLOW_METHF_SINGLE_UCLASS) {
                                        scan_next_in_uclass(&dev);
                                        log_debug("looking for next device %s: 
%s\n",
-- 
2.43.0

Reply via email to