summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0626795)
raw | patch | inline | side by side (parent: 0626795)
author | Suman Anna <s-anna@ti.com> | |
Tue, 30 Oct 2018 18:06:34 +0000 (13:06 -0500) | ||
committer | Suman Anna <s-anna@ti.com> | |
Wed, 27 Feb 2019 20:35:18 +0000 (14:35 -0600) |
The current name field used in the remoteproc structure is simply
a pointer to a name field supplied during the rproc_alloc() call.
The pointer passed in by remoteproc drivers during registration is
typically a dev_name pointer, but it is possible that the pointer
will no longer remain valid if the devices themselves were created
at runtime like in the case of of_platform_populate(), and were
deleted upon any failures within the respective remoteproc driver
probe function.
So, allocate and maintain a local copy for this name field to
keep it agnostic of the logic used in the remoteproc drivers.
Signed-off-by: Suman Anna <s-anna@ti.com>
a pointer to a name field supplied during the rproc_alloc() call.
The pointer passed in by remoteproc drivers during registration is
typically a dev_name pointer, but it is possible that the pointer
will no longer remain valid if the devices themselves were created
at runtime like in the case of of_platform_populate(), and were
deleted upon any failures within the respective remoteproc driver
probe function.
So, allocate and maintain a local copy for this name field to
keep it agnostic of the logic used in the remoteproc drivers.
Signed-off-by: Suman Anna <s-anna@ti.com>
drivers/remoteproc/remoteproc_core.c | patch | blob | history | |
include/linux/remoteproc.h | patch | blob | history |
index c9be95b4e1ba84f1e94cbf4d0b13a6c1cedfafc5..e112e3663958651d0b3221c5c8b552f9ab7ec4f6 100644 (file)
kfree(rproc->firmware);
kfree(rproc->ops);
+ kfree(rproc->name);
kfree(rproc);
}
}
rproc->firmware = p;
- rproc->name = name;
+ rproc->name = kstrdup(name, GFP_KERNEL);
+ if (!rproc->name) {
+ kfree(p);
+ kfree(rproc->ops);
+ kfree(rproc);
+ return NULL;
+ }
rproc->priv = &rproc[1];
rproc->auto_boot = true;
index 5efeb757f182ae8916649804f825efd083c80ecd..8f0789a3865fe3bdeb4ee8b0f951910437a97f26 100644 (file)
struct rproc {
struct list_head node;
struct iommu_domain *domain;
- const char *name;
+ char *name;
char *firmware;
void *priv;
struct rproc_ops *ops;