From: Simon Horman <horms@kernel.org>
To: Ruan Jinjie <ruanjinjie@huawei.com>
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
Date: Tue, 1 Aug 2023 17:40:01 +0200 [thread overview]
Message-ID: <ZMknUZudTKGwsEpG@kernel.org> (raw)
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 <ruanjinjie@huawei.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
>
>
next prev parent reply other threads:[~2023-08-01 15:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-01 12:34 [PATCH net-next] net/mlx4: remove many unnecessary NULL values Ruan Jinjie
2023-08-01 15:40 ` Simon Horman [this message]
2023-08-02 2:27 ` Ruan Jinjie
2023-08-01 17:55 ` Jesse Brandeburg
2023-08-02 2:35 ` Ruan Jinjie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZMknUZudTKGwsEpG@kernel.org \
--to=horms@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=ruanjinjie@huawei.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).