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

Commit 89970d28 authored by Wei Yongjun's avatar Wei Yongjun Committed by Ohad Ben-Cohen
Browse files

remoteproc: fix error return code in rproc_fw_boot()



Set 'ret' to -EINVAL when needed, so a sensible return value
is returned on errors.

Signed-off-by: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
[fix additional instances of this bug as well, update commit log]
Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
parent 9e895ace
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -815,18 +815,17 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
	}

	rproc->bootaddr = rproc_get_boot_addr(rproc, fw);
	ret = -EINVAL;

	/* look for the resource table */
	table = rproc_find_rsc_table(rproc, fw, &tablesz);
	if (!table) {
		ret = -EINVAL;
		goto clean_up;
	}

	/* Verify that resource table in loaded fw is unchanged */
	if (rproc->table_csum != crc32(0, table, tablesz)) {
		dev_err(dev, "resource checksum failed, fw changed?\n");
		ret = -EINVAL;
		goto clean_up;
	}

@@ -852,8 +851,10 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
	 * copy this information to device memory.
	 */
	loaded_table = rproc_find_loaded_rsc_table(rproc, fw);
	if (!loaded_table)
	if (!loaded_table) {
		ret = -EINVAL;
		goto clean_up;
	}

	memcpy(loaded_table, rproc->cached_table, tablesz);