Skip to content
Commit 90af2731 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Peter Rosin
Browse files

i2c: mux: pinctrl: use flexible-array member and struct_size() helper



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: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: default avatarPeter Rosin <peda@axentia.se>
parent d9a183bf
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment