]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
extcon: Use devm_kcalloc() in extcon_dev_register()
authorMarkus Elfring <elfring@users.sourceforge.net>
Sun, 23 Apr 2017 18:54:11 +0000 (20:54 +0200)
committerChanwoo Choi <cw00.choi@samsung.com>
Tue, 23 May 2017 09:32:02 +0000 (18:32 +0900)
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>
drivers/extcon/extcon.c

index f422a78ba342428c6e4da7d4bb4a15ebfcf92ec9..acb847bc1619e17716474fa7b84eec9c4e00a3bd 100644 (file)
@@ -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;