Move test for unnecessary memmove to memmove_wd()
Signed-off-by: Larry Johnson <lrj@acm.org>
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 452686d..da06009 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -344,11 +344,8 @@
printf (" XIP %s ... ", type_name);
} else {
printf (" Loading %s ... ", type_name);
-
- if (load != image_start) {
- memmove_wd ((void *)load,
- (void *)image_start, image_len, CHUNKSZ);
- }
+ memmove_wd ((void *)load, (void *)image_start,
+ image_len, CHUNKSZ);
}
*load_end = load + image_len;
puts("OK\n");
diff --git a/common/image.c b/common/image.c
index 9e49713..8d4be14 100644
--- a/common/image.c
+++ b/common/image.c
@@ -450,6 +450,9 @@
void memmove_wd (void *to, void *from, size_t len, ulong chunksz)
{
+ if (to == from)
+ return;
+
#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
while (len > 0) {
size_t tail = (len > chunksz) ? chunksz : len;