Re: [PATCH] i2c: mux: pinctrl: use flexible-array member and struct_size() helper

From: Peter Rosin
Date: Tue Jun 11 2019 - 03:26:05 EST


On 2019-06-03 16:53, Gustavo A. R. Silva wrote:
> Update the code to use a flexible array member instead of a pointer in
> structure i2c_mux_pinctrl and use the struct_size() helper.
>
> Also, make use of the struct_size() helper instead of an open-coded
> version in order to avoid any potential type mistakes, in particular
> in the context in which this code is being used.
>
> So, replace the following form:
>
> sizeof(*mux) + num_names * sizeof(*mux->states)
>
> with:
>
> struct_size(mux, states, num_names)
>
> This code was detected with the help of Coccinelle.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@xxxxxxxxxxxxxx>

Thanks, patch applied to i2c-mux/for-next

Cheers,
Peter