1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-10-26 16:13:55 +01:00

global: Convert simple_strtoul() with hex to hextoul()

It is a pain to have to specify the value 16 in each call. Add a new
hextoul() function and update the code to use it.

Add a proper comment to simple_strtoul() while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2021-07-24 09:03:29 -06:00
committed by Tom Rini
parent 031725f8cd
commit 7e5f460ec4
183 changed files with 692 additions and 659 deletions

View File

@@ -397,7 +397,7 @@ int hash_parse_string(const char *algo_name, const char *str, uint8_t *result)
char chr[3];
strlcpy(chr, &str[i * 2], 3);
result[i] = simple_strtoul(chr, NULL, 16);
result[i] = hextoul(chr, NULL);
}
return 0;
@@ -470,7 +470,7 @@ static void store_result(struct hash_algo *algo, const uint8_t *sum,
ulong addr;
void *buf;
addr = simple_strtoul(dest, NULL, 16);
addr = hextoul(dest, NULL);
buf = map_sysmem(addr, algo->digest_size);
memcpy(buf, sum, algo->digest_size);
unmap_sysmem(buf);
@@ -510,7 +510,7 @@ static int parse_verify_sum(struct hash_algo *algo, char *verify_str,
ulong addr;
void *buf;
addr = simple_strtoul(verify_str, NULL, 16);
addr = hextoul(verify_str, NULL);
buf = map_sysmem(addr, algo->digest_size);
memcpy(vsum, buf, algo->digest_size);
} else {
@@ -555,8 +555,8 @@ int hash_command(const char *algo_name, int flags, struct cmd_tbl *cmdtp,
if ((argc < 2) || ((flags & HASH_FLAG_VERIFY) && (argc < 3)))
return CMD_RET_USAGE;
addr = simple_strtoul(*argv++, NULL, 16);
len = simple_strtoul(*argv++, NULL, 16);
addr = hextoul(*argv++, NULL);
len = hextoul(*argv++, NULL);
if (multi_hash()) {
struct hash_algo *algo;
@@ -628,7 +628,7 @@ int hash_command(const char *algo_name, int flags, struct cmd_tbl *cmdtp,
addr, addr + len - 1, crc);
if (argc >= 3) {
ptr = (ulong *)simple_strtoul(argv[0], NULL, 16);
ptr = (ulong *)hextoul(argv[0], NULL);
*ptr = crc;
}
}