bus: arm-ccn: Use devm_kcalloc() in arm_ccn_probe()
authorMarkus Elfring <elfring@users.sourceforge.net>
Wed, 19 Apr 2017 07:12:43 +0000 (09:12 +0200)
committerPawel Moll <pawel.moll@arm.com>
Fri, 23 Jun 2017 14:46:36 +0000 (15:46 +0100)
Multiplications for the size determination of memory allocations
indicated that array data structures should be processed.
Thus use the corresponding function "devm_kcalloc".

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Pawel Moll <pawel.moll@arm.com>
drivers/bus/arm-ccn.c

index 80758f6fdaa56bec5833946462fb3d3172773e0b..5aaa645ba7269605035d9cba11a33cdb8aa67dce 100644 (file)
@@ -1520,10 +1520,10 @@ static int arm_ccn_probe(struct platform_device *pdev)
        if (err)
                return err;
 
-       ccn->node = devm_kzalloc(ccn->dev, sizeof(*ccn->node) * ccn->num_nodes,
-               GFP_KERNEL);
-       ccn->xp = devm_kzalloc(ccn->dev, sizeof(*ccn->node) * ccn->num_xps,
-               GFP_KERNEL);
+       ccn->node = devm_kcalloc(ccn->dev, ccn->num_nodes, sizeof(*ccn->node),
+                                GFP_KERNEL);
+       ccn->xp = devm_kcalloc(ccn->dev, ccn->num_xps, sizeof(*ccn->node),
+                              GFP_KERNEL);
        if (!ccn->node || !ccn->xp)
                return -ENOMEM;