Commit 229b85a6 authored by Bjorn Andersson's avatar Bjorn Andersson

remoteproc: Correct resource handling upon boot failure

The freeing of resources will attempt to clear values previously set in
the cached resource table, so make sure to free the table after we have
cleaned up the resources.

Fixes: 988d204c ("remoteproc: Move handling of cached table to boot/shutdown")
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent eeac0a87
...@@ -847,14 +847,14 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) ...@@ -847,14 +847,14 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
ret = rproc_handle_resources(rproc, tablesz, rproc_loading_handlers); ret = rproc_handle_resources(rproc, tablesz, rproc_loading_handlers);
if (ret) { if (ret) {
dev_err(dev, "Failed to process resources: %d\n", ret); dev_err(dev, "Failed to process resources: %d\n", ret);
goto clean_up; goto clean_up_resources;
} }
/* load the ELF segments to memory */ /* load the ELF segments to memory */
ret = rproc_load_segments(rproc, fw); ret = rproc_load_segments(rproc, fw);
if (ret) { if (ret) {
dev_err(dev, "Failed to load program segments: %d\n", ret); dev_err(dev, "Failed to load program segments: %d\n", ret);
goto clean_up; goto clean_up_resources;
} }
/* /*
...@@ -875,7 +875,7 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) ...@@ -875,7 +875,7 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
ret = rproc->ops->start(rproc); ret = rproc->ops->start(rproc);
if (ret) { if (ret) {
dev_err(dev, "can't start rproc %s: %d\n", rproc->name, ret); dev_err(dev, "can't start rproc %s: %d\n", rproc->name, ret);
goto clean_up; goto clean_up_resources;
} }
rproc->state = RPROC_RUNNING; rproc->state = RPROC_RUNNING;
...@@ -884,12 +884,13 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw) ...@@ -884,12 +884,13 @@ static int rproc_fw_boot(struct rproc *rproc, const struct firmware *fw)
return 0; return 0;
clean_up_resources:
rproc_resource_cleanup(rproc);
clean_up: clean_up:
kfree(rproc->cached_table); kfree(rproc->cached_table);
rproc->cached_table = NULL; rproc->cached_table = NULL;
rproc->table_ptr = NULL; rproc->table_ptr = NULL;
rproc_resource_cleanup(rproc);
rproc_disable_iommu(rproc); rproc_disable_iommu(rproc);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment