diff options
author | Gustavo A. R. Silva <gustavo@embeddedor.com> | 2019-06-07 02:11:44 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2019-06-08 02:29:43 +0300 |
commit | d32aa74555575a0692f4e06fe39a673a1877eff6 (patch) | |
tree | 60793254feef686146cff59bf83b1361db27d604 /drivers/nvmem/mtk-efuse.c | |
parent | 76c4c597b2ef59900933fca8893428f0555afaab (diff) | |
download | linux-d32aa74555575a0692f4e06fe39a673a1877eff6.tar.xz |
pinctrl: tb10x: Use flexible-array member and struct_size() helper
Update the code to use a flexible array member instead of a pointer in
structure tb10x_pinctrl and use the struct_size() helper:
struct tb10x_pinctrl {
...
struct tb10x_of_pinfunc pinfuncs[];
};
Also, make use of the struct_size() helper instead of an open-coded
version in order to avoid any potential type mistakes.
So, replace the following form:
sizeof(struct tb10x_pinctrl) + of_get_child_count(of_node) * sizeof(struct tb10x_of_pinfunc)
with:
struct_size(state, pinfuncs, of_get_child_count(of_node))
This code was detected with the help of Coccinelle.
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/nvmem/mtk-efuse.c')
0 files changed, 0 insertions, 0 deletions