Skip to content

Commit cf5459a

Browse files
elfringchanwoochoi
authored andcommitted
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 <[email protected]> Reviewed-by: Charles Keepax <[email protected]> Signed-off-by: Chanwoo Choi <[email protected]>
1 parent 826a47e commit cf5459a

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/extcon/extcon-arizona.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,9 +1271,7 @@ static int arizona_extcon_get_micd_configs(struct device *dev,
12711271
goto out;
12721272

12731273
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),
12771275
GFP_KERNEL);
12781276
if (!micd_configs) {
12791277
ret = -ENOMEM;

0 commit comments

Comments
 (0)