summaryrefslogtreecommitdiff
path: root/cmd/elf.c
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2018-04-11 22:02:20 -0700
committerBin Meng <bmeng.cn@gmail.com>2018-04-16 22:38:52 +0800
commit7824ad6ad494c4489fdd997212b5566638fc840b (patch)
tree8d90c8016c198a83022aa96186df3826d9408923 /cmd/elf.c
parent447ae4f7adb2c667eec1e0861e2346694c57a2e0 (diff)
bootvx: Refactor the bootline copy codes a little bit
There is a small duplication in do_bootvx() that does the bootline copy. Refactor this a little bit to make it simpler. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'cmd/elf.c')
-rw-r--r--cmd/elf.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/cmd/elf.c b/cmd/elf.c
index 30c845833b..407d136a03 100644
--- 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);
}