aboutsummaryrefslogtreecommitdiff
path: root/cmd/gpt.c
diff options
context:
space:
mode:
authorHeinrich Schuchardt2023-08-26 03:53:41 +0200
committerHeinrich Schuchardt2023-08-27 08:21:07 +0200
commit018346770b04e32caf75d5730301f3ba52ed005f (patch)
tree979249cc9ab2afe5247e1565849f9ac045209201 /cmd/gpt.c
parenteb48efce260aefc0eceec90bd4d9adcd881f1b14 (diff)
cmd: fix gpt setenv
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>
Diffstat (limited to 'cmd/gpt.c')
-rw-r--r--cmd/gpt.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/cmd/gpt.c b/cmd/gpt.c
index 007a68eaa72..d0e165d5394 100644
--- 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 */