Message ID | 20200512094404.16534-3-peng.fan@nxp.com |
---|---|
State | New |
Headers | show |
Series | spl: imx: update and fix | expand |
> Subject: [PATCH 2/5] spl: romapi: avoid copy data when get fit image size > Drop this patch, this is wrong. Regards, Peng. > 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
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;
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(-)