From: Marek Vasut Date: Tue, 28 May 2019 03:49:13 +0200 Subject: [U-Boot] [PATCH 1/3] spl: ram: Do not memcpy() identical buffers Message-ID: <20190528014915.6202-1-marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 Cc: Michal Simek Cc: Tom Rini --- 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