From patchwork Tue May 12 09:44:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 245645 List-Id: U-Boot discussion From: peng.fan at nxp.com (Peng Fan) Date: Tue, 12 May 2020 17:44:01 +0800 Subject: [PATCH 2/5] spl: romapi: avoid copy data when get fit image size In-Reply-To: <20200512094404.16534-1-peng.fan@nxp.com> References: <20200512094404.16534-1-peng.fan@nxp.com> Message-ID: <20200512094404.16534-3-peng.fan@nxp.com> No need to copy data when only need to get fit image size. Signed-off-by: Peng Fan --- arch/arm/mach-imx/spl_imx_romapi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/spl_imx_romapi.c b/arch/arm/mach-imx/spl_imx_romapi.c index 1a695ea837..d753d0207c 100644 --- a/arch/arm/mach-imx/spl_imx_romapi.c +++ b/arch/arm/mach-imx/spl_imx_romapi.c @@ -124,14 +124,14 @@ static int spl_romapi_load_image_seekable(struct spl_image_info *spl_image, static ulong spl_ram_load_read(struct spl_load_info *load, ulong sector, ulong count, void *buf) { - memcpy(buf, (void *)(sector), count); - if (load->priv) { ulong *p = (ulong *)load->priv; ulong total = sector + count; if (total > *p) *p = total; + } else { + memcpy(buf, (void *)(sector), count); } return count;