Commit 74457c40 authored by Loic Pallardy's avatar Loic Pallardy Committed by Bjorn Andersson

remoteproc: fix rproc_da_to_va in case of unallocated carveout

With introduction of rproc_alloc_registered_carveouts() which
delays carveout allocation just before the start of the remote
processor, rproc_da_to_va() could be called before all carveouts
are allocated.
This patch adds a check in rproc_da_to_va() to return NULL if
carveout is not allocated.

Fixes: d7c51706 ("remoteproc: add alloc ops in rproc_mem_entry struct")
Signed-off-by: default avatarLoic Pallardy <loic.pallardy@st.com>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
parent a9f6fe0d
...@@ -207,6 +207,10 @@ void *rproc_da_to_va(struct rproc *rproc, u64 da, int len) ...@@ -207,6 +207,10 @@ void *rproc_da_to_va(struct rproc *rproc, u64 da, int len)
list_for_each_entry(carveout, &rproc->carveouts, node) { list_for_each_entry(carveout, &rproc->carveouts, node) {
int offset = da - carveout->da; int offset = da - carveout->da;
/* Verify that carveout is allocated */
if (!carveout->va)
continue;
/* try next carveout if da is too small */ /* try next carveout if da is too small */
if (offset < 0) if (offset < 0)
continue; continue;
......
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