diff options
author | Simon Glass <sjg@chromium.org> | 2023-01-17 10:47:15 -0700 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-01-23 18:11:39 -0500 |
commit | 6a6638f0939dca65c7d1cd0d766957d3d3adc519 (patch) | |
tree | 7eb2cae66d5f768a0e57322600f3bc604016df3b /boot/bootdev-uclass.c | |
parent | 3e96ed44e8c5b63bd0cef1e263e7991ac16c21e3 (diff) |
bootstd: Remove special-case code for boot_targets
Rather than implement this as its own case in build_order(), process the
boot_targets environment variable in the bootstd_get_bootdev_order()
function. This allows build_order() to be simplified.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'boot/bootdev-uclass.c')
-rw-r--r-- | boot/bootdev-uclass.c | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c index affe0d3e04..696efb4b19 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -12,7 +12,6 @@ #include <bootflow.h> #include <bootmeth.h> #include <bootstd.h> -#include <env.h> #include <fs.h> #include <log.h> #include <malloc.h> @@ -504,34 +503,13 @@ static int build_order(struct udevice *bootstd, struct udevice **order, const char *overflow_target = NULL; const char *const *labels; struct udevice *dev; - const char *targets; int i, ret, count; + bool ok; - targets = env_get("boot_targets"); - labels = IS_ENABLED(CONFIG_BOOTSTD_FULL) ? - bootstd_get_bootdev_order(bootstd) : NULL; - if (targets) { - char str[BOOT_TARGETS_MAX_LEN]; - char *target; - - if (strlen(targets) >= BOOT_TARGETS_MAX_LEN) - return log_msg_ret("len", -E2BIG); - - /* make a copy of the string, since strok() will change it */ - strcpy(str, targets); - for (i = 0, target = strtok(str, " "); target; - target = strtok(NULL, " ")) { - ret = bootdev_find_by_label(target, &dev); - if (!ret) { - if (i == max_count) { - overflow_target = target; - break; - } - order[i++] = dev; - } - } - count = i; - } else if (labels) { + labels = bootstd_get_bootdev_order(bootstd, &ok); + if (!ok) + return log_msg_ret("ord", -ENOMEM); + if (labels) { int upto; upto = 0; |