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

Signed-off-by: Peng Fan <peng....@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

Reply via email to