Subject: Re: [PATCH 1/3] of: dynamic: add of_property_alloc() and of_property_free()

From: Clément Léger <[email-masked]>
Date: Fri, 6 May 2022 09:43:39 +0200

Le Thu, 5 May 2022 12:37:38 -0500,
Rob Herring <[email-masked]> a écrit :

> > >   
> > > -	/* mark the property as dynamic */
> > > -	of_property_set_flag(new, OF_DYNAMIC);
> > > +	prop->value = kzalloc(alloc_len, allocflags);
> > > +	if (!prop->value)
> > > +		goto out_err;
> > >   
> > > -	return new;
> > > +	if (value)
> > > +		memcpy(prop->value, value, value_len);  
> > 
> > Could you use kmemdup() instead of kzalloc+memcpy ?  
> 
> I'd prefer there be 1 alloc for struct property and value instead of 2. 
> And maybe 'name' gets rolled into it too, but that gets a bit more 
> complicated to manage I think. 

At least for value it should be easy indeed. i'll check what I can do
for the name.

> 
> With memcpy, note this series[1].

Ok, good to know, should I base my series on that one ?

> 
> Rob
> 
> [1] https://lore.kernel.org/all/[email-masked]/

-- 
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com