diff options
author | Bjorn Andersson <bjorn.andersson@linaro.org> | 2018-01-05 18:58:00 -0500 |
---|---|---|
committer | Bjorn Andersson <bjorn.andersson@linaro.org> | 2018-01-15 12:29:34 -0500 |
commit | fb98e2bdbd5f5949459dcfe9976bdafdb0ed1948 (patch) | |
tree | f67e7500d32efdb60c191614dc5003a03542c4eb /drivers/remoteproc | |
parent | a4b24c7560ba64c3c54d8f90ee033a6f0565f8d3 (diff) |
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')
-rw-r--r-- | drivers/remoteproc/remoteproc_core.c | 9 |
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) | |||
1342 | ida_simple_remove(&rproc_dev_index, rproc->index); | 1342 | ida_simple_remove(&rproc_dev_index, rproc->index); |
1343 | 1343 | ||
1344 | kfree(rproc->firmware); | 1344 | kfree(rproc->firmware); |
1345 | kfree(rproc->ops); | ||
1345 | kfree(rproc); | 1346 | kfree(rproc); |
1346 | } | 1347 | } |
1347 | 1348 | ||
@@ -1406,9 +1407,15 @@ struct rproc *rproc_alloc(struct device *dev, const char *name, | |||
1406 | return NULL; | 1407 | return NULL; |
1407 | } | 1408 | } |
1408 | 1409 | ||
1410 | rproc->ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL); | ||
1411 | if (!rproc->ops) { | ||
1412 | kfree(p); | ||
1413 | kfree(rproc); | ||
1414 | return NULL; | ||
1415 | } | ||
1416 | |||
1409 | rproc->firmware = p; | 1417 | rproc->firmware = p; |
1410 | rproc->name = name; | 1418 | rproc->name = name; |
1411 | rproc->ops = ops; | ||
1412 | rproc->priv = &rproc[1]; | 1419 | rproc->priv = &rproc[1]; |
1413 | rproc->auto_boot = true; | 1420 | rproc->auto_boot = true; |
1414 | 1421 | ||