Hi Sascha, On 19-02-12 08:32, Sascha Hauer wrote: > Hi Marco, > > On Mon, Feb 11, 2019 at 05:20:12PM +0100, Marco Felsch wrote: > > Sometimes it can be necessary to rename a node, e.g. to override/create > > a node which gets renamed upstream. > > > > Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx> > > --- > > drivers/of/base.c | 18 ++++++++++++++++++ > > include/of.h | 5 +++++ > > 2 files changed, 23 insertions(+) > > > > diff --git a/drivers/of/base.c b/drivers/of/base.c > > index b082f0c656..6644d9b96a 100644 > > --- a/drivers/of/base.c > > +++ b/drivers/of/base.c > > @@ -2094,6 +2094,24 @@ void of_delete_node(struct device_node *node) > > of_set_root_node(NULL); > > } > > > > +void of_rename_node(struct device_node *node, char *name) > > Should be const char * name. Okay. > > > +{ > > + struct device_node *parent; > > + > > + if (!node) > > + return; > > + > > + parent = node->parent; > > + if (parent) { > > + node->name = name; > > node->name is an allocated string. It should be freed and then set to an > allocated string again. Okay, I will do this. > > > + node->full_name = basprintf("%s/%s", parent->full_name, name); > > + } else { > > + /* root node */ > > + node->name = xstrdup(""); > > + node->full_name = xstrdup(""); > > I think we can drop the else path entirely. If we do not allow to give > the root node a name then we can assume that it doesn't have a name > right now, so nothing to do here. Sure, I will change this. Regards, Marco > Sascha > > -- > Pengutronix e.K. | | > Industrial Linux Solutions | http://www.pengutronix.de/ | > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox