aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-12-15 20:14:22 -0700
committerTom Rini <trini@konsulko.com>2023-12-21 16:07:52 -0500
commit6b50aff13f55262210636d7329811c649173fb67 (patch)
tree70544abe6fda49d8d77a9775b45e210fb7e79460
parente1a24c025c3b065b417bd0dd491cb7000583b334 (diff)
downloadu-boot-6b50aff13f55262210636d7329811c649173fb67.zip
u-boot-6b50aff13f55262210636d7329811c649173fb67.tar.gz
u-boot-6b50aff13f55262210636d7329811c649173fb67.tar.bz2
stm32: Use local vars in stm32prog for initrd and fdt
Rather than assigning to the bootm_argv[] array multiple times, use local variables for the two things that can change and assign them at the end. This makes it easier to drop the array eventually. Tidu up an overly short line while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
-rw-r--r--arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
index 2411bcf..8670535 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
@@ -124,30 +124,35 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
char boot_addr_start[20];
char dtb_addr[20];
char initrd_addr[40];
+ char *fdt_arg, *initrd_arg;
char *bootm_argv[5] = {
- "bootm", boot_addr_start, "-", dtb_addr, NULL
+ "bootm", boot_addr_start,
};
const void *uimage = (void *)data->uimage;
const void *dtb = (void *)data->dtb;
const void *initrd = (void *)data->initrd;
+ fdt_arg = dtb_addr;
if (!dtb)
- bootm_argv[3] = env_get("fdtcontroladdr");
+ fdt_arg = env_get("fdtcontroladdr");
else
- snprintf(dtb_addr, sizeof(dtb_addr) - 1,
- "0x%p", dtb);
+ snprintf(dtb_addr, sizeof(dtb_addr) - 1, "0x%p", dtb);
snprintf(boot_addr_start, sizeof(boot_addr_start) - 1,
"0x%p", uimage);
+ initrd_arg = "-";
if (initrd) {
- snprintf(initrd_addr, sizeof(initrd_addr) - 1, "0x%p:0x%zx",
- initrd, data->initrd_size);
- bootm_argv[2] = initrd_addr;
+ snprintf(initrd_addr, sizeof(initrd_addr) - 1,
+ "0x%p:0x%zx", initrd, data->initrd_size);
+ initrd_arg = initrd_addr;
}
- printf("Booting kernel at %s %s %s...\n\n\n",
- boot_addr_start, bootm_argv[2], bootm_argv[3]);
+ printf("Booting kernel at %s %s %s...\n\n\n", boot_addr_start,
+ initrd_arg, fdt_arg);
+ bootm_argv[2] = initrd_arg;
+ bootm_argv[3] = fdt_arg;
+
/* Try bootm for legacy and FIT format image */
if (genimg_get_format(uimage) != IMAGE_FORMAT_INVALID)
do_bootm(cmdtp, 0, 4, bootm_argv);