[PATCH net-next] net/mlx5e: Remove a useless function call

Christophe JAILLET posted 1 patch 2 years, 8 months ago
drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH net-next] net/mlx5e: Remove a useless function call
Posted by Christophe JAILLET 2 years, 8 months ago
'handle' is known to be NULL here. There is no need to kfree() it.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c
index 0290e0dea539..4e923a2874ae 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c
@@ -112,10 +112,8 @@ mlx5e_tc_post_act_add(struct mlx5e_post_act *post_act, struct mlx5_flow_attr *po
 	int err;
 
 	handle = kzalloc(sizeof(*handle), GFP_KERNEL);
-	if (!handle) {
-		kfree(handle);
+	if (!handle)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	post_attr->chain = 0;
 	post_attr->prio = 0;
-- 
2.34.1
Re: [PATCH net-next] net/mlx5e: Remove a useless function call
Posted by Saeed Mahameed 2 years, 8 months ago
On 29 May 10:34, Christophe JAILLET wrote:
>'handle' is known to be NULL here. There is no need to kfree() it.
>
>Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>


Applied to net-next-mlx5.

Thanks
Re: [PATCH net-next] net/mlx5e: Remove a useless function call
Posted by Tariq Toukan 2 years, 8 months ago

On 29/05/2023 11:34, Christophe JAILLET wrote:
> 'handle' is known to be NULL here. There is no need to kfree() it.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c
> index 0290e0dea539..4e923a2874ae 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc/post_act.c
> @@ -112,10 +112,8 @@ mlx5e_tc_post_act_add(struct mlx5e_post_act *post_act, struct mlx5_flow_attr *po
>   	int err;
>   
>   	handle = kzalloc(sizeof(*handle), GFP_KERNEL);
> -	if (!handle) {
> -		kfree(handle);
> +	if (!handle)
>   		return ERR_PTR(-ENOMEM);
> -	}
>   
>   	post_attr->chain = 0;
>   	post_attr->prio = 0;

Reviewed-by: Tariq Toukan <tariqt@nvidia.com>

Thanks for your patch.
Re: [PATCH net-next] net/mlx5e: Remove a useless function call
Posted by Simon Horman 2 years, 8 months ago
On Mon, May 29, 2023 at 10:34:59AM +0200, Christophe JAILLET wrote:
> 'handle' is known to be NULL here. There is no need to kfree() it.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Simon Horman <simon.horman@corigine.com>