[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220506124339.2c772fa0@fixe.home>
Date: Fri, 6 May 2022 12:43:39 +0200
From: Clément Léger <clement.leger@...tlin.com>
To: Rob Herring <robh@...nel.org>
Cc: Michael Ellerman <mpe@...erman.id.au>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Frank Rowand <frowand.list@...il.com>,
Nathan Lynch <nathanl@...ux.ibm.com>,
Laurent Dufour <ldufour@...ux.ibm.com>,
Daniel Henrique Barboza <danielhb413@...il.com>,
David Gibson <david@...son.dropbear.id.au>,
Andrew Morton <akpm@...ux-foundation.org>,
David Hildenbrand <david@...hat.com>,
Ohhoon Kwon <ohoono.kwon@...sung.com>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
YueHaibing <yuehaibing@...wei.com>,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org,
Allan Nielsen <allan.nielsen@...rochip.com>,
Horatiu Vultur <horatiu.vultur@...rochip.com>,
Steen Hegelund <steen.hegelund@...rochip.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH 2/3] of: dynamic: add of_node_alloc() and of_node_free()
Le Thu, 5 May 2022 14:43:54 -0500,
Rob Herring <robh@...nel.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@...tlin.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
Powered by blists - more mailing lists