Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

extcon: arizona: Use devm_kcalloc() in arizona_extcon_get_micd_configs()

* A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "devm_kcalloc".

* Replace the specification of a data structure by a pointer dereference
to make the corresponding size determination a bit safer according to
the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>

authored by

Markus Elfring and committed by
Chanwoo Choi
cf5459a9 826a47e9

+1 -3
+1 -3
drivers/extcon/extcon-arizona.c
··· 1271 1271 goto out; 1272 1272 1273 1273 nconfs /= entries_per_config; 1274 - 1275 - micd_configs = devm_kzalloc(dev, 1276 - nconfs * sizeof(struct arizona_micd_range), 1274 + micd_configs = devm_kcalloc(dev, nconfs, sizeof(*micd_configs), 1277 1275 GFP_KERNEL); 1278 1276 if (!micd_configs) { 1279 1277 ret = -ENOMEM;