aboutsummaryrefslogtreecommitdiff
path: root/drivers/remoteproc
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2013-06-30 11:07:13 +0300
committerOhad Ben-Cohen <ohad@wizery.com>2013-06-30 11:07:13 +0300
commit89970d28cb3fd1c678f769d62d077c10ec5340e1 (patch)
tree72f6003c37242453686adbe1c96bb1b0deafb71a /drivers/remoteproc
parent9e895ace5d82df8929b16f58e9f515f6d54ab82d (diff)
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: Wei Yongjun <yongjun_wei@trendmicro.com.cn> [fix additional instances of this bug as well, update commit log] Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r--drivers/remoteproc/remoteproc_core.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 022dc635d01..7e33536b5c2 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -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);