diff options
author | Loic Pallardy <loic.pallardy@st.com> | 2019-01-10 14:49:06 +0100 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2019-02-20 21:34:18 -0800 |
commit | 74457c40f97a98142bb13153395d304ad3c85cdd (patch) | |
tree | 9b3d4485f0c0b7d27c4cc2b91ffa89608791048d /drivers/remoteproc | |
parent | a9f6fe0d728e615f344cd42567e6894ca3070de9 (diff) | |
download | linux-74457c40f97a98142bb13153395d304ad3c85cdd.tar.bz2 |
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: d7c51706d095 ("remoteproc: add alloc ops in rproc_mem_entry struct")
Signed-off-by: Loic Pallardy <loic.pallardy@st.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r-- | drivers/remoteproc/remoteproc_core.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index a97c4b7b28e1..dfa2f6ecaf90 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -207,6 +207,10 @@ void *rproc_da_to_va(struct rproc *rproc, u64 da, int len) list_for_each_entry(carveout, &rproc->carveouts, node) { int offset = da - carveout->da; + /* Verify that carveout is allocated */ + if (!carveout->va) + continue; + /* try next carveout if da is too small */ if (offset < 0) continue; |