From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0474D1ADC6 for ; Tue, 1 Aug 2023 15:40:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3843C433C9; Tue, 1 Aug 2023 15:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690904405; bh=X1mwOoTIB7hJQicL/Hgqt1xt/e11C2x0nJ6bkn43y9g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fsJl7GDDsBSKKFeF8Ip+VemK5Na+5zrPvm4qpZ6xK/fYu7bSfNOZ30AshNFL5I3j9 yKb17kE4P6AwuIofYAtl/B6roFw5SdPgJAITnVGHYZt00zme7fw2xgWcyjFwNLKwRn 4kDJS3jCBtMOjJck4ERdinf2VEG7X7F+ThTwyhvBKLJpDL7CouR4K7gPDs3MoyIV8/ 5IRIQpetqVjCbxAXvKhVjVxFUoLdGyRaA7//vC2sd3gLaPCdrbkwOPEfNc7DAHLWvD 7q8GbkOmaIam75Eqt6BiwuVYOhzsv0Wm3/x/NNbSq4duYtWkE3rS7IZ79gcddP6wGk AmVumZfMwlLoQ== Date: Tue, 1 Aug 2023 17:40:01 +0200 From: Simon Horman To: Ruan Jinjie Cc: tariqt@nvidia.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-rdma@vger.kernel.org, netdev@vger.kernel.org Subject: Re: [PATCH net-next] net/mlx4: remove many unnecessary NULL values Message-ID: References: <20230801123422.374541-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230801123422.374541-1-ruanjinjie@huawei.com> 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 ... > 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 > >