diff mbox series

RDMA/mlx5: Replace kzalloc with kcalloc

Message ID 20190115060048.GA9911@embeddedor (mailing list archive)
State Mainlined
Commit 8e8aa1454205839030c9406febd1f6d4ece0d573
Delegated to: Jason Gunthorpe
Headers show
Series RDMA/mlx5: Replace kzalloc with kcalloc | expand

Commit Message

Gustavo A. R. Silva Jan. 15, 2019, 6 a.m. UTC
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>
---
 drivers/infiniband/hw/mlx5/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky Jan. 15, 2019, 10:39 a.m. UTC | #1
On Tue, Jan 15, 2019 at 12:00:48AM -0600, Gustavo A. R. Silva wrote:
> 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>
> ---
>  drivers/infiniband/hw/mlx5/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Thanks,
Acked-by: Leon Romanovsky <leonro@mellanox.com>
Jason Gunthorpe Jan. 15, 2019, 10:54 p.m. UTC | #2
On Tue, Jan 15, 2019 at 12:00:48AM -0600, Gustavo A. R. Silva wrote:
> 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>
> ---
>  drivers/infiniband/hw/mlx5/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next

Thanks,
Jason
Gustavo A. R. Silva Jan. 15, 2019, 11:03 p.m. UTC | #3
On 1/15/19 4:54 PM, Jason Gunthorpe wrote:
> On Tue, Jan 15, 2019 at 12:00:48AM -0600, Gustavo A. R. Silva wrote:
>> 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>
>> ---
>>  drivers/infiniband/hw/mlx5/main.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Applied to for-next
> 

Thank you both, Leon and Jason.

--
Gustavo
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 11e9783cefcc..89dc2c6fc173 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -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);