aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc/remoteproc_core.c
diff options
context:
space:
mode:
authorBjorn Andersson <bjorn.andersson@linaro.org>2018-01-05 15:58:00 -0800
committerBjorn Andersson <bjorn.andersson@linaro.org>2018-01-15 09:29:34 -0800
commitfb98e2bdbd5f5949459dcfe9976bdafdb0ed1948 (patch)
treef67e7500d32efdb60c191614dc5003a03542c4eb /drivers/remoteproc/remoteproc_core.c
parentremoteproc: Cache resource table size (diff)
downloadlinux-dev-fb98e2bdbd5f5949459dcfe9976bdafdb0ed1948.tar.xz
linux-dev-fb98e2bdbd5f5949459dcfe9976bdafdb0ed1948.zip
remoteproc: Clone rproc_ops in rproc_alloc()
In order to allow rproc_alloc() to, in a future patch, update entries in the "ops" struct we need to make a local copy of it. Reviewed-By: Loic Pallardy <loic.pallardy@st.com> Tested-By: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/remoteproc/remoteproc_core.c')
-rw-r--r--drivers/remoteproc/remoteproc_core.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 208ccf709cad..dbf685dbafcf 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1342,6 +1342,7 @@ static void rproc_type_release(struct device *dev)
ida_simple_remove(&rproc_dev_index, rproc->index);
kfree(rproc->firmware);
+ kfree(rproc->ops);
kfree(rproc);
}
@@ -1406,9 +1407,15 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
return NULL;
}
+ rproc->ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL);
+ if (!rproc->ops) {
+ kfree(p);
+ kfree(rproc);
+ return NULL;
+ }
+
rproc->firmware = p;
rproc->name = name;
- rproc->ops = ops;
rproc->priv = &rproc[1];
rproc->auto_boot = true;