coresight: Use devm_kcalloc() in coresight_alloc_conns()
authorXu Wang <vulab@iscas.ac.cn>
Thu, 16 Jul 2020 17:57:36 +0000 (11:57 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 21 Jul 2020 13:48:39 +0000 (15:48 +0200)
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: Xu Wang <vulab@iscas.ac.cn>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20200716175746.3338735-8-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwtracing/coresight/coresight-platform.c

index e4912ab..bfd4423 100644 (file)
@@ -27,9 +27,8 @@ static int coresight_alloc_conns(struct device *dev,
                                 struct coresight_platform_data *pdata)
 {
        if (pdata->nr_outport) {
-               pdata->conns = devm_kzalloc(dev, pdata->nr_outport *
-                                           sizeof(*pdata->conns),
-                                           GFP_KERNEL);
+               pdata->conns = devm_kcalloc(dev, pdata->nr_outport,
+                                           sizeof(*pdata->conns), GFP_KERNEL);
                if (!pdata->conns)
                        return -ENOMEM;
        }