[PATCH 07/17] bootstd: Fully complete iteration of a uclass
Simon Glass
sjg at chromium.org
Wed Mar 19 15:38:01 CET 2025
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.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
boot/bootflow.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/boot/bootflow.c b/boot/bootflow.c
index 83a1d3a7c8b..473e4d5f02c 100644
--- a/boot/bootflow.c
+++ b/boot/bootflow.c
@@ -292,7 +292,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
More information about the U-Boot
mailing list