On 2023/8/1 23:40, Simon Horman wrote: > 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. I think these NULL assignments can also be removed. > >> Signed-off-by: Ruan Jinjie <ruanjinjie@xxxxxxxxxx> > > ... > >> 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(). Yes, this kind of situation the NULL assignments should not be removed,I'll reserch it more. > >> -- >> 2.34.1 >> >>