Re: [PATCH net-next] net/mlx4: remove many unnecessary NULL values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@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().

> -- 
> 2.34.1
> 
> 



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux