1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-01 00:32:04 +02:00

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>
This commit is contained in:
Bin Meng
2018-04-11 22:02:20 -07:00
parent 447ae4f7ad
commit 7824ad6ad4

View File

@@ -313,12 +313,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
* construct the info. * construct the info.
*/ */
bootline = env_get("bootargs"); bootline = env_get("bootargs");
if (bootline) { if (!bootline) {
memcpy((void *)bootaddr, bootline,
max(strlen(bootline), (size_t)255));
flush_cache(bootaddr, max(strlen(bootline),
(size_t)255));
} else {
tmp = env_get("bootdev"); tmp = env_get("bootdev");
if (tmp) { if (tmp) {
strcpy(build_buf, 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); ptr += strlen(tmp);
} }
memcpy((void *)bootaddr, build_buf, bootline = build_buf;
max(strlen(build_buf), (size_t)255));
flush_cache(bootaddr, max(strlen(build_buf),
(size_t)255));
} }
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, printf("## Using bootline (@ 0x%lx): %s\n", bootaddr,
(char *)bootaddr); (char *)bootaddr);
} }