提交 48cb5b68 编写于 作者: T Tzung-Bi Shih 提交者: Bjorn Andersson

remoteproc/mediatek: skip if filesz is 0

The main purpose of the loop is to load the memory to the SCP SRAM.
If filesz is 0, can go to next program header directly.

We don't need to try to validate the FW binary for those filesz==0
segments.
Reviewed-by: NMathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: NTzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201116084413.3312631-3-tzungbi@google.comSigned-off-by: NBjorn Andersson <bjorn.andersson@linaro.org>
上级 71ffb5a2
...@@ -234,12 +234,14 @@ static int scp_elf_load_segments(struct rproc *rproc, const struct firmware *fw) ...@@ -234,12 +234,14 @@ static int scp_elf_load_segments(struct rproc *rproc, const struct firmware *fw)
u32 offset = phdr->p_offset; u32 offset = phdr->p_offset;
void __iomem *ptr; void __iomem *ptr;
if (phdr->p_type != PT_LOAD)
continue;
dev_dbg(dev, "phdr: type %d da 0x%x memsz 0x%x filesz 0x%x\n", dev_dbg(dev, "phdr: type %d da 0x%x memsz 0x%x filesz 0x%x\n",
phdr->p_type, da, memsz, filesz); phdr->p_type, da, memsz, filesz);
if (phdr->p_type != PT_LOAD)
continue;
if (!filesz)
continue;
if (filesz > memsz) { if (filesz > memsz) {
dev_err(dev, "bad phdr filesz 0x%x memsz 0x%x\n", dev_err(dev, "bad phdr filesz 0x%x memsz 0x%x\n",
filesz, memsz); filesz, memsz);
...@@ -263,9 +265,7 @@ static int scp_elf_load_segments(struct rproc *rproc, const struct firmware *fw) ...@@ -263,9 +265,7 @@ static int scp_elf_load_segments(struct rproc *rproc, const struct firmware *fw)
} }
/* put the segment where the remote processor expects it */ /* put the segment where the remote processor expects it */
if (phdr->p_filesz) scp_memcpy_aligned(ptr, elf_data + phdr->p_offset, filesz);
scp_memcpy_aligned(ptr, elf_data + phdr->p_offset,
filesz);
} }
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册