linux/drivers/i2c
Gustavo A. R. Silva 90af27317b 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: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Peter Rosin <peda@axentia.se>
2019-06-10 09:28:56 +02:00
..
algos treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
busses treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 114 2019-05-24 17:39:01 +02:00
muxes i2c: mux: pinctrl: use flexible-array member and struct_size() helper 2019-06-10 09:28:56 +02:00
i2c-boardinfo.c i2c: i2c-boardinfo: fix memory leaks on devinfo 2017-11-27 19:14:29 +01:00
i2c-core-acpi.c i2c: acpi: Introduce i2c_acpi_get_i2c_resource() helper 2018-12-03 21:40:02 +02:00
i2c-core-base.c i2c: core: add device-managed version of i2c_new_dummy 2019-05-17 19:29:40 +02:00
i2c-core-of.c i2c: of: Try to find an I2C adapter matching the parent 2019-02-05 13:41:49 +01:00
i2c-core-slave.c i2c: remove i2c_lock_adapter and use i2c_lock_bus directly 2018-07-13 00:09:37 +02:00
i2c-core-smbus.c i2c: core: apply 'is_suspended' check for SMBus, too 2019-05-03 16:44:51 +02:00
i2c-core.h i2c: core: apply 'is_suspended' check for SMBus, too 2019-05-03 16:44:51 +02:00
i2c-dev.c i2c: expand minor range when registering chrdev region 2019-02-15 09:53:34 +01:00
i2c-mux.c i2c: mux: Use struct_size() in devm_kzalloc() 2019-06-10 09:28:46 +02:00
i2c-slave-eeprom.c i2c: Drop owner assignment from i2c_driver 2015-08-10 08:37:35 +02:00
i2c-smbus.c i2c: i2c-smbus: add of_i2c_setup_smbus_alert 2017-10-28 23:42:47 +02:00
i2c-stub.c treewide: kzalloc() -> kcalloc() 2018-06-12 16:19:22 -07:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile i2c: don't use any __deprecated handling anymore 2018-08-24 17:26:43 +02:00