otx2_common: Use devm_kcalloc() in otx2_config_npa()
authorXu Wang <vulab@iscas.ac.cn>
Mon, 17 Aug 2020 02:04:13 +0000 (02:04 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Aug 2020 22:08:39 +0000 (15:08 -0700)
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: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c

index 5975521..93c4cf7 100644 (file)
@@ -1226,8 +1226,8 @@ int otx2_config_npa(struct otx2_nic *pfvf)
        if (!hw->pool_cnt)
                return -EINVAL;
 
-       qset->pool = devm_kzalloc(pfvf->dev, sizeof(struct otx2_pool) *
-                                 hw->pool_cnt, GFP_KERNEL);
+       qset->pool = devm_kcalloc(pfvf->dev, hw->pool_cnt,
+                                 sizeof(struct otx2_pool), GFP_KERNEL);
        if (!qset->pool)
                return -ENOMEM;