linux-stable/drivers/pinctrl/sirf
Gustavo A. R. Silva 1e11820f72 pinctrl: sirf: atlas7: 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>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2019-01-11 13:24:21 +01:00
..
Makefile pinctrl: sirf: add sirf atlas7 pinctrl and gpio support 2015-05-19 16:01:30 +02:00
pinctrl-atlas6.c pinctrl: atlas6: Add I2S external clock input pingroup 2014-08-29 08:42:13 +02:00
pinctrl-atlas7.c pinctrl: sirf: atlas7: use struct_size() in devm_kzalloc() 2019-01-11 13:24:21 +01:00
pinctrl-prima2.c pinctrl: prima2: add I2S 2ch, 6ch, nodin, mclk groups 2014-09-04 19:07:19 +02:00
pinctrl-sirf.c pinctrl: Include <linux/gpio/driver.h> nothing else 2018-09-14 15:10:57 +02:00
pinctrl-sirf.h pinctrl: sirf: drop marco support 2015-01-14 14:21:54 +01:00