Re: [PATCH] i2c: mux: demux-pinctrl: use struct_size() in devm_kzalloc()

2019-04-22 Thread Wolfram Sang
On Sun, Apr 21, 2019 at 06:15:21PM +, Peter Rosin wrote: > On 2019-01-04 19:06, Wolfram Sang wrote: > > > >> Instead of leaving these open-coded and prone to type mistakes, we can > >> now use the new struct_size() helper: > > > > I am okay with this patch in general. However, I think the

Re: [PATCH] i2c: mux: demux-pinctrl: use struct_size() in devm_kzalloc()

2019-04-21 Thread Peter Rosin
On 2019-01-04 19:06, Wolfram Sang wrote: > >> Instead of leaving these open-coded and prone to type mistakes, we can >> now use the new struct_size() helper: > > I am okay with this patch in general. However, I think the name of the > helper 'struct_size' is a bit unfortunate. I really wondered

[PATCH] i2c: mux: demux-pinctrl: use struct_size() in devm_kzalloc()

2019-01-04 Thread Gustavo A. R. Silva
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct foo { int stuff; void *entry[]; }; instance = devm_kzalloc(dev,

Re: [PATCH] i2c: mux: demux-pinctrl: use struct_size() in devm_kzalloc()

2019-01-04 Thread Wolfram Sang
> Instead of leaving these open-coded and prone to type mistakes, we can > now use the new struct_size() helper: I am okay with this patch in general. However, I think the name of the helper 'struct_size' is a bit unfortunate. I really wondered on the first read why it needs 3 arguments to find