If the source and destination buffer address is identical, there is
no need to memcpy() the content. Skip the memcpy() in such a case.

Signed-off-by: Marek Vasut <ma...@denx.de>
Cc: Michal Simek <michal.si...@xilinx.com>
Cc: Tom Rini <tr...@konsulko.com>
---
 common/spl/spl_ram.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c
index 954e91a004..2ef33f717e 100644
--- a/common/spl/spl_ram.c
+++ b/common/spl/spl_ram.c
@@ -24,7 +24,8 @@ static ulong spl_ram_load_read(struct spl_load_info *load, 
ulong sector,
 {
        debug("%s: sector %lx, count %lx, buf %lx\n",
              __func__, sector, count, (ulong)buf);
-       memcpy(buf, (void *)(CONFIG_SPL_LOAD_FIT_ADDRESS + sector), count);
+       if (buf != CONFIG_SPL_LOAD_FIT_ADDRESS + sector)
+               memcpy(buf, (void *)(CONFIG_SPL_LOAD_FIT_ADDRESS + sector), 
count);
        return count;
 }
 
-- 
2.20.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to