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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le Thu, 5 May 2022 12:37:38 -0500,
Rob Herring <robh@xxxxxxxxxx> 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@xxxxxxxxxxxx/


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




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux