[PATCH 2/3] of: dynamic: add of_node_alloc() and of_node_free()
Clément Léger
clement.leger at bootlin.com
Fri May 6 20:43:39 AEST 2022
Le Thu, 5 May 2022 14:43:54 -0500,
Rob Herring <robh at kernel.org> a écrit :
> On Wed, May 04, 2022 at 05:40:32PM +0200, Clément Léger wrote:
> > Add functions which allows to create and free nodes.
> >
> > Signed-off-by: Clément Léger <clement.leger at bootlin.com>
> > ---
> > drivers/of/dynamic.c | 59 ++++++++++++++++++++++++++++++++++++--------
> > include/linux/of.h | 9 +++++++
> > 2 files changed, 58 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
> > index e8700e509d2e..ec28e5ba2969 100644
> > --- a/drivers/of/dynamic.c
> > +++ b/drivers/of/dynamic.c
> > @@ -455,6 +455,54 @@ struct property *__of_prop_dup(const struct property *prop, gfp_t allocflags)
> > prop->length, allocflags);
> > }
> >
> > +/**
> > + * of_node_free - Free a node allocated dynamically.
> > + * @node: Node to be freed
> > + */
> > +void of_node_free(const struct device_node *node)
> > +{
> > + kfree(node->full_name);
> > + kfree(node->data);
> > + kfree(node);
> > +}
> > +EXPORT_SYMBOL(of_node_free);
>
> This shouldn't be needed. Nodes are refcounted, so any caller should
> just do a put.
Acked. Do you want the name to be allocated as part of the node
allocation also ?
>
> Rob
--
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com
More information about the Linuxppc-dev
mailing list