[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZMknUZudTKGwsEpG@kernel.org>
Date: Tue, 1 Aug 2023 17:40:01 +0200
From: Simon Horman <horms@...nel.org>
To: Ruan Jinjie <ruanjinjie@...wei.com>
Cc: tariqt@...dia.com, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, linux-rdma@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH net-next] net/mlx4: remove many unnecessary NULL values
On Tue, Aug 01, 2023 at 08:34:22PM +0800, Ruan Jinjie wrote:
> Ther are many pointers assigned first, which need not to be initialized, so
> remove the NULL assignment.
How about something like:
Don't initialise local variables to NULL which are always
set to other values elsewhere in the same function.
> Signed-off-by: Ruan Jinjie <ruanjinjie@...wei.com>
...
> diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
...
> @@ -2294,8 +2294,8 @@ static int mlx4_init_fw(struct mlx4_dev *dev)
> static int mlx4_init_hca(struct mlx4_dev *dev)
> {
> struct mlx4_priv *priv = mlx4_priv(dev);
> - struct mlx4_init_hca_param *init_hca = NULL;
> - struct mlx4_dev_cap *dev_cap = NULL;
> + struct mlx4_init_hca_param *init_hca;
> + struct mlx4_dev_cap *dev_cap;
> struct mlx4_adapter adapter;
> struct mlx4_profile profile;
> u64 icm_size;
This last hunk doesn't seem correct, as it doesn't
seem these aren't always initialised elsewhere in the function
before being passed to kfree().
> --
> 2.34.1
>
>
Powered by blists - more mailing lists