[U-Boot] [PATCH 1/3] spl: ram: Do not memcpy() identical buffers
Marek Vasut
marex at denx.de
Tue May 28 01:49:13 UTC 2019
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 <marex at denx.de>
Cc: Michal Simek <michal.simek at xilinx.com>
Cc: Tom Rini <trini at 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
More information about the U-Boot
mailing list