Skip to content

Commit

Permalink
extcon: Use devm_kcalloc() in extcon_dev_register()
Browse files Browse the repository at this point in the history
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".

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
  • Loading branch information
Markus Elfring authored and Chanwoo Choi committed May 23, 2017
1 parent 0833289 commit 3f5071a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/extcon/extcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,9 +1252,8 @@ int extcon_dev_register(struct extcon_dev *edev)
}

spin_lock_init(&edev->lock);

edev->nh = devm_kzalloc(&edev->dev,
sizeof(*edev->nh) * edev->max_supported, GFP_KERNEL);
edev->nh = devm_kcalloc(&edev->dev, edev->max_supported,
sizeof(*edev->nh), GFP_KERNEL);
if (!edev->nh) {
ret = -ENOMEM;
goto err_dev;
Expand Down

0 comments on commit 3f5071a

Please sign in to comment.