[PATCH 2/5] spl: romapi: avoid copy data when get fit image size

Peng Fan peng.fan at nxp.com
Tue May 12 11:44:01 CEST 2020


No need to copy data when only need to get fit image size.

Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
 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;
-- 
2.16.4



More information about the U-Boot mailing list