* [PATCH net-next] net/mlx5: Use kzalloc for allocating only one thing
@ 2020-12-29 13:53 Zheng Yongjun
2020-12-29 16:17 ` Joe Perches
0 siblings, 1 reply; 2+ messages in thread
From: Zheng Yongjun @ 2020-12-29 13:53 UTC (permalink / raw)
To: davem, kuba, netdev, linux-rdma, linux-kernel; +Cc: saeedm, leon, Zheng Yongjun
Use kzalloc rather than kcalloc(1,...)
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
@@
- kcalloc(1,
+ kzalloc(
...)
// </smpl>
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
index df1363a34a42..9837d2e8d687 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
@@ -1782,7 +1782,7 @@ static int dr_action_create_modify_action(struct mlx5dr_domain *dmn,
if (!chunk)
return -ENOMEM;
- hw_actions = kcalloc(1, max_hw_actions * DR_MODIFY_ACTION_SIZE, GFP_KERNEL);
+ hw_actions = kzalloc(max_hw_actions * DR_MODIFY_ACTION_SIZE, GFP_KERNEL);
if (!hw_actions) {
ret = -ENOMEM;
goto free_chunk;
--
2.22.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] net/mlx5: Use kzalloc for allocating only one thing
2020-12-29 13:53 [PATCH net-next] net/mlx5: Use kzalloc for allocating only one thing Zheng Yongjun
@ 2020-12-29 16:17 ` Joe Perches
0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2020-12-29 16:17 UTC (permalink / raw)
To: Zheng Yongjun, davem, kuba, netdev, linux-rdma, linux-kernel; +Cc: saeedm, leon
On Tue, 2020-12-29 at 21:53 +0800, Zheng Yongjun wrote:
> Use kzalloc rather than kcalloc(1,...)
[]
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_action.c
[]
> @@ -1782,7 +1782,7 @@ static int dr_action_create_modify_action(struct mlx5dr_domain *dmn,
> if (!chunk)
> return -ENOMEM;
>
>
> - hw_actions = kcalloc(1, max_hw_actions * DR_MODIFY_ACTION_SIZE, GFP_KERNEL);
> + hw_actions = kzalloc(max_hw_actions * DR_MODIFY_ACTION_SIZE, GFP_KERNEL);
Perhaps instead:
hw_actions = kcalloc(max_hw_actions, DR_MODIFY_ACTION_SIZE, GFP_KERNEL);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-12-29 16:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-29 13:53 [PATCH net-next] net/mlx5: Use kzalloc for allocating only one thing Zheng Yongjun
2020-12-29 16:17 ` Joe Perches
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.