[PATCH v3 25/46] net: Return the address and size from parse_addr_size()
Simon Glass
sjg at chromium.org
Fri Dec 6 03:36:04 CET 2024
Rather than updating the global, update the value of some parameters,
so the action of the function is simpler.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
(no changes since v1)
cmd/net.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/cmd/net.c b/cmd/net.c
index d15d344cb54..cc968e9460f 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -297,13 +297,15 @@ static void netboot_update_env(void)
/**
* parse_addr_size() - parse address and size arguments for tftpput
*
- * @argv: command line arguments
+ * @argv: command line arguments (argv[1] and argv[2] must be valid)
+ * @addrp: returns the address, on success
+ * @sizep: returns the size, on success
* Return: 0 on success
*/
-static int parse_addr_size(char * const argv[])
+static int parse_addr_size(char * const argv[], ulong *addrp, ulong *sizep)
{
- if (strict_strtoul(argv[1], 16, &image_save_addr) < 0 ||
- strict_strtoul(argv[2], 16, &image_save_size) < 0) {
+ if (strict_strtoul(argv[1], 16, addrp) < 0 ||
+ strict_strtoul(argv[2], 16, sizep) < 0) {
printf("Invalid address/size\n");
return CMD_RET_USAGE;
}
@@ -356,7 +358,8 @@ static int parse_args(enum proto_t proto, int argc, char *const argv[],
case 3:
if (IS_ENABLED(CONFIG_CMD_TFTPPUT) && proto == TFTPPUT) {
- if (parse_addr_size(argv))
+ if (parse_addr_size(argv, &image_save_addr,
+ &image_save_size))
return 1;
} else {
*addrp = hextoul(argv[1], NULL);
@@ -366,7 +369,7 @@ static int parse_args(enum proto_t proto, int argc, char *const argv[],
#ifdef CONFIG_CMD_TFTPPUT
case 4:
- if (parse_addr_size(argv))
+ if (parse_addr_size(argv, &image_save_addr, &image_save_size))
return 1;
*fnamep = argv[3];
break;
--
2.34.1
More information about the U-Boot
mailing list