aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-09-04 10:51:58 -0400
committerTom Rini <trini@konsulko.com>2023-09-04 10:51:58 -0400
commitddec4cae624e48c3678ea856fa7d6292a7104238 (patch)
treebb04231fb05cf9d3fc018bf874bbb6e8373968d8 /cmd
parentf2bb6d9ffd9ba0d0d89c00445a70cf81327a7af2 (diff)
parentb27eeca112c1b9eef6f06a320a4310d766ac5659 (diff)
downloadu-boot-ddec4cae624e48c3678ea856fa7d6292a7104238.zip
u-boot-ddec4cae624e48c3678ea856fa7d6292a7104238.tar.gz
u-boot-ddec4cae624e48c3678ea856fa7d6292a7104238.tar.bz2
Merge tag 'v2023.10-rc4' into next
Prepare v2023.10-rc4
Diffstat (limited to 'cmd')
-rw-r--r--cmd/gpt.c24
-rw-r--r--cmd/printf.c6
2 files changed, 14 insertions, 16 deletions
diff --git a/cmd/gpt.c b/cmd/gpt.c
index 8969efb..3cc6436 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -689,12 +689,13 @@ static int gpt_enumerate(struct blk_desc *desc)
int ret;
int i;
+ if (part_drv->test(desc))
+ continue;
+
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;
ptr = &part_list[str_len];
tmp_len = strlen((const char *)pinfo.name);
@@ -709,9 +710,10 @@ static int gpt_enumerate(struct blk_desc *desc)
/* One byte for space(" ") delimiter */
ptr[tmp_len] = ' ';
}
+ if (*part_list)
+ part_list[strlen(part_list) - 1] = 0;
+ break;
}
- if (*part_list)
- part_list[strlen(part_list) - 1] = 0;
debug("setenv gpt_partition_list %s\n", part_list);
return env_set("gpt_partition_list", part_list);
@@ -740,7 +742,7 @@ static int gpt_setenv_part_variables(struct disk_partition *pinfo, int i)
if (ret)
goto fail;
- ret = env_set_ulong("gpt_partition_entry", i);
+ ret = env_set_hex("gpt_partition_entry", i);
if (ret)
goto fail;
@@ -784,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 */
@@ -1058,8 +1058,6 @@ U_BOOT_CMD(gpt, CONFIG_SYS_MAXARGS, 1, do_gpt,
" gpt_partition_name, gpt_partition_entry\n"
" gpt enumerate mmc 0\n"
" - store list of partitions to gpt_partition_list environment variable\n"
- " read <interface> <dev>\n"
- " - read GPT into a data structure for manipulation\n"
" gpt guid <interface> <dev>\n"
" - print disk GUID\n"
" gpt guid <interface> <dev> <varname>\n"
diff --git a/cmd/printf.c b/cmd/printf.c
index e024676..0c6887e 100644
--- a/cmd/printf.c
+++ b/cmd/printf.c
@@ -144,10 +144,10 @@ static void printf_str(struct print_inf *inf, char *format, ...)
i = vsnprintf(inf->str + inf->offset, remaining, format, args);
va_end(args);
- if (i >= remaining)
- inf->error |= PRINT_TRUNCATED_ERROR;
- else if (i < 0)
+ if (i < 0)
inf->error |= PRINT_CONVERSION_ERROR;
+ else if ((unsigned int)i >= remaining)
+ inf->error |= PRINT_TRUNCATED_ERROR;
else
inf->offset += i;
}