From: Markus Elfring Date: Sun, 23 Apr 2017 18:54:11 +0000 (+0200) Subject: extcon: Use devm_kcalloc() in extcon_dev_register() X-Git-Tag: v4.13-rc1~185^2~11^2~4 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=3f5071a8b07b697993a16bbe9cbc8c876ba60048;p=karo-tx-linux.git extcon: Use devm_kcalloc() in extcon_dev_register() 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 Signed-off-by: Chanwoo Choi --- diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index f422a78ba342..acb847bc1619 100644 --- a/drivers/extcon/extcon.c +++ b/drivers/extcon/extcon.c @@ -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;