bootvx: Refactor the bootline copy codes a little bit
[oweals/u-boot.git] / cmd / elf.c
index 30c845833b6f6030545bb33a273f061867e0b3c1..407d136a034f1e68d65211369f3935481d751ac5 100644 (file)
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -313,12 +313,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                 * construct the info.
                 */
                bootline = env_get("bootargs");
-               if (bootline) {
-                       memcpy((void *)bootaddr, bootline,
-                              max(strlen(bootline), (size_t)255));
-                       flush_cache(bootaddr, max(strlen(bootline),
-                                                 (size_t)255));
-               } else {
+               if (!bootline) {
                        tmp = env_get("bootdev");
                        if (tmp) {
                                strcpy(build_buf, tmp);
@@ -369,12 +364,12 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                                ptr += strlen(tmp);
                        }
 
-                       memcpy((void *)bootaddr, build_buf,
-                              max(strlen(build_buf), (size_t)255));
-                       flush_cache(bootaddr, max(strlen(build_buf),
-                                                 (size_t)255));
+                       bootline = build_buf;
                }
 
+               memcpy((void *)bootaddr, bootline,
+                      max(strlen(bootline), (size_t)255));
+               flush_cache(bootaddr, max(strlen(bootline), (size_t)255));
                printf("## Using bootline (@ 0x%lx): %s\n", bootaddr,
                       (char *)bootaddr);
        }