aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorMarek Vasut2023-03-11 17:29:21 +0100
committerSimon Glass2023-04-03 06:53:53 +1200
commit2fb74a1d134bf675869e548c8f3f8c014b7ee473 (patch)
tree4939b275d2dc3d62309c843f6a827da8c5ebf219 /cmd
parent90999b456902a7fe760e74f09b88b55141e7c20f (diff)
cmd: fdt: Use env_set_hex() for "get addr" and "get size"
The 'fdt get addr' and 'env get size' is always assumed to be hex value, drop the prefix, and outright switch to env_set_hex(). Since this might break existing users who depend on the existing behavior with 0x prefix, this is a separate patch. Revert if this breaks anything. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/fdt.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/cmd/fdt.c b/cmd/fdt.c
index 04b664e652c..87d9a385075 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -475,18 +475,9 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
if (ret != 0)
return ret;
} else if (subcmd[0] == 'a') {
- /* Get address */
- char buf[19];
-
- snprintf(buf, sizeof(buf), "%lx",
- (ulong)map_to_sysmem(nodep));
- env_set(var, buf);
+ env_set_hex(var, (ulong)map_to_sysmem(nodep));
} else if (subcmd[0] == 's') {
- /* Get size */
- char buf[11];
-
- sprintf(buf, "0x%08X", len);
- env_set(var, buf);
+ env_set_hex(var, len);
} else
return CMD_RET_USAGE;
return 0;