leds: gpio: Use struct_size() in devm_kzalloc()
authorGustavo A. R. Silva <gustavoars@kernel.org>
Fri, 19 Jun 2020 22:14:03 +0000 (17:14 -0500)
committerPavel Machek <pavel@ucw.cz>
Sun, 12 Jul 2020 08:28:01 +0000 (10:28 +0200)
commitcf1a1a6a7d81d73bcb5568b23572d6fd593add87
treeae676ad71662219e5e86ff5b1e5f64962084adba
parenta7ad53cb6687069024efbd3af734c7811f63d2a5
leds: gpio: Use struct_size() in devm_kzalloc()

Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes. Also, remove unnecessary
function sizeof_gpio_leds_priv().

This code was detected with the help of Coccinelle and, audited and
fixed manually.

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
drivers/leds/leds-gpio.c