OSDN Git Service

RDMA/mlx5: Replace kzalloc with kcalloc
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Tue, 15 Jan 2019 06:00:48 +0000 (00:00 -0600)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 15 Jan 2019 22:53:08 +0000 (15:53 -0700)
Replace kzalloc() function with its 2-factor argument form, kcalloc().

This patch replaces cases of:

kzalloc(a * b, gfp)

with:
kcalloc(a, b, gfp)

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Acked-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/mlx5/main.c

index 4b1b56d..61064b7 100644 (file)
@@ -3823,7 +3823,7 @@ mlx5_ib_raw_fs_rule_add(struct mlx5_ib_dev *dev,
        if (fs_matcher->priority > MLX5_IB_FLOW_LAST_PRIO)
                return ERR_PTR(-ENOMEM);
 
-       dst = kzalloc(sizeof(*dst) * 2, GFP_KERNEL);
+       dst = kcalloc(2, sizeof(*dst), GFP_KERNEL);
        if (!dst)
                return ERR_PTR(-ENOMEM);