mirror of https://gitee.com/openkylin/linux.git
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>
This commit is contained in:
parent
a4b24c7560
commit
fb98e2bdbd
|
@ -1342,6 +1342,7 @@ static void rproc_type_release(struct device *dev)
|
||||||
ida_simple_remove(&rproc_dev_index, rproc->index);
|
ida_simple_remove(&rproc_dev_index, rproc->index);
|
||||||
|
|
||||||
kfree(rproc->firmware);
|
kfree(rproc->firmware);
|
||||||
|
kfree(rproc->ops);
|
||||||
kfree(rproc);
|
kfree(rproc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1406,9 +1407,15 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rproc->ops = kmemdup(ops, sizeof(*ops), GFP_KERNEL);
|
||||||
|
if (!rproc->ops) {
|
||||||
|
kfree(p);
|
||||||
|
kfree(rproc);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
rproc->firmware = p;
|
rproc->firmware = p;
|
||||||
rproc->name = name;
|
rproc->name = name;
|
||||||
rproc->ops = ops;
|
|
||||||
rproc->priv = &rproc[1];
|
rproc->priv = &rproc[1];
|
||||||
rproc->auto_boot = true;
|
rproc->auto_boot = true;
|
||||||
|
|
||||||
|
|
|
@ -419,7 +419,7 @@ struct rproc {
|
||||||
const char *name;
|
const char *name;
|
||||||
char *firmware;
|
char *firmware;
|
||||||
void *priv;
|
void *priv;
|
||||||
const struct rproc_ops *ops;
|
struct rproc_ops *ops;
|
||||||
struct device dev;
|
struct device dev;
|
||||||
const struct rproc_fw_ops *fw_ops;
|
const struct rproc_fw_ops *fw_ops;
|
||||||
atomic_t power;
|
atomic_t power;
|
||||||
|
|
Loading…
Reference in New Issue