]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
cmd: fix gpt setenv
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sat, 26 Aug 2023 01:53:41 +0000 (03:53 +0200)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sun, 27 Aug 2023 06:21:07 +0000 (08:21 +0200)
Do not assume that partitions are continuously numbered starting at 1.

Having a partition table with a single partition 63 is valid.

Fixes: 12fc1f3bb223 ("cmd: gpt: add eMMC and GPT support")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
cmd/gpt.c

index 007a68eaa72a6ada286a36683946edb7bf450e9c..d0e165d5394a855297a826747177754411154afb 100644 (file)
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -786,10 +786,8 @@ static int gpt_setenv(struct blk_desc *desc, const char *name)
 
                for (i = 1; i < part_drv->max_entries; i++) {
                        ret = part_drv->get_info(desc, i, &pinfo);
-                       if (ret) {
-                               /* no more entries in table */
-                               break;
-                       }
+                       if (ret)
+                               continue;
 
                        if (!strcmp(name, (const char *)pinfo.name)) {
                                /* match found, setup environment variables */