Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c205b9c authored by Bjorn Helgaas's avatar Bjorn Helgaas Committed by Ralf Baechle
Browse files

MIPS: VPE: Exit vpe_release() early if vpe_run() isn't defined



vpe_run() is a weak symbol.  If there's no definition of it, its value is
zero.

If vpe_run is zero, return failure early.  We're going to fail anyway, so
there's no point in getting a VPE and attempting to load it.

Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Cc: Andrew Bresticker <abrestic@chromium.org>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/10683/


Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 27d8d449
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -821,13 +821,18 @@ static int vpe_release(struct inode *inode, struct file *filp)
	Elf_Ehdr *hdr;
	Elf_Ehdr *hdr;
	int ret = 0;
	int ret = 0;


	if (!vpe_run) {
		pr_warn("VPE loader: ELF load failed.\n");
		return -ENOEXEC;
	}

	v = get_vpe(aprp_cpu_index());
	v = get_vpe(aprp_cpu_index());
	if (v == NULL)
	if (v == NULL)
		return -ENODEV;
		return -ENODEV;


	hdr = (Elf_Ehdr *) v->pbuffer;
	hdr = (Elf_Ehdr *) v->pbuffer;
	if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) == 0) {
	if (memcmp(hdr->e_ident, ELFMAG, SELFMAG) == 0) {
		if ((vpe_elfload(v) >= 0) && vpe_run) {
		if (vpe_elfload(v) >= 0) {
			vpe_run(v);
			vpe_run(v);
		} else {
		} else {
			pr_warn("VPE loader: ELF load failed.\n");
			pr_warn("VPE loader: ELF load failed.\n");