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

Clément Léger clement.leger at bootlin.com
Fri May 6 17:43:39 AEST 2022


Le Thu, 5 May 2022 12:37:38 -0500,
Rob Herring <robh at kernel.org> 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/20220504014440.3697851-30-keescook@chromium.org/


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


More information about the Linuxppc-dev mailing list