linux/drivers/i2c/muxes
Gustavo A. R. Silva d5984d2a31 i2c: mux: demux-pinctrl: use struct_size() in devm_kzalloc()
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, sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);

Instead of leaving these open-coded and prone to type mistakes, we can
now use the new struct_size() helper:

instance = devm_kzalloc(dev, struct_size(instance, entry, count), GFP_KERNEL);

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Peter Rosin <peda@axentia.se>
2019-04-21 23:45:08 +02:00
..
i2c-arb-gpio-challenge.c i2c: arb: gpio-challenge: stop double error reporting 2017-04-03 14:07:32 +02:00
i2c-demux-pinctrl.c i2c: mux: demux-pinctrl: use struct_size() in devm_kzalloc() 2019-04-21 23:45:08 +02:00
i2c-mux-gpio.c gpiolib: Pass array info to get/set array functions 2018-09-13 11:16:54 +02:00
i2c-mux-gpmux.c i2c: Convert to using %pOFn instead of device_node.name 2018-10-05 14:10:40 +02:00
i2c-mux-ltc4306.c i2c: mux: ltc4306: simplify code to reach the adapter 2018-10-08 23:44:27 +02:00
i2c-mux-mlxcpld.c i2c: mux: mlxcpld: simplify code to reach the adapter 2018-10-08 23:44:28 +02:00
i2c-mux-pca954x.c i2c: mux: pca954x: allow management of device idle state via sysfs 2019-04-21 23:44:37 +02:00
i2c-mux-pca9541.c i2c: mux: pca9541: remove support for unused platform data 2019-04-21 23:44:37 +02:00
i2c-mux-pinctrl.c i2c: mux: pinctrl: potential NULL dereference on error 2017-08-17 14:19:56 +02:00
i2c-mux-reg.c Merge branch 'i2c/for-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2018-06-14 16:21:46 +09:00
Kconfig i2c: mux: pca954x: add support for NXP PCA984x family 2017-12-30 23:12:34 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00