Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Ruan Jinjie <ruanjinjie@huawei.com>
To: Jesse Brandeburg <jesse.brandeburg@intel.com>,
	<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: Wed, 2 Aug 2023 10:35:06 +0800	[thread overview]
Message-ID: <4f2336ed-7fb2-b720-b2f1-d65e4e2e46fc@huawei.com> (raw)
In-Reply-To: <4811ee1d-45d7-c484-f4f0-20228afc048b@intel.com>



On 2023/8/2 1:55, Jesse Brandeburg wrote:
> On 8/1/2023 5:34 AM, Ruan Jinjie wrote:
>> Ther are many pointers assigned first, which need not to be initialized, so
>> remove the NULL assignment.
>>
>> Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com>
> 
> Thanks for your patch, make sure you're always explaining "why" you're
> making a change in your commit message.

Thank you for your sincere advice! I'll notice the issue in future patches.

> 
> but see below please.
> 
>> ---
>>  drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 10 +++++-----
>>  drivers/net/ethernet/mellanox/mlx4/en_netdev.c  |  4 ++--
>>  drivers/net/ethernet/mellanox/mlx4/main.c       | 12 ++++++------
>>  3 files changed, 13 insertions(+), 13 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
>> index 7d45f1d55f79..164a13272faa 100644
>> --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
>> +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
>> @@ -1467,8 +1467,8 @@ static int add_ip_rule(struct mlx4_en_priv *priv,
>>  		       struct list_head *list_h)
>>  {
>>  	int err;
>> -	struct mlx4_spec_list *spec_l2 = NULL;
>> -	struct mlx4_spec_list *spec_l3 = NULL;
>> +	struct mlx4_spec_list *spec_l2;
>> +	struct mlx4_spec_list *spec_l3;
> 
> What sequence of commands did you use to identify this set of things to
> change? That would be useful data for the commit message.
> 
> gcc with -Wunused-something?
> cppcheck?

Just code walk-through and some keyword match such as malloc and NULL
assignment.

> 
> I've sent these types of patches before, but they've been rejected as
> churn if they don't fix a clear W=1 or C=2 warning.
> 
> Did you run the above and see these issues?
> 
> 
>>  	struct ethtool_usrip4_spec *l3_mask = &cmd->fs.m_u.usr_ip4_spec;
>>  
>>  	spec_l3 = kzalloc(sizeof(*spec_l3), GFP_KERNEL);
>> @@ -1505,9 +1505,9 @@ static int add_tcp_udp_rule(struct mlx4_en_priv *priv,
>>  			     struct list_head *list_h, int proto)
>>  {
>>  	int err;
>> -	struct mlx4_spec_list *spec_l2 = NULL;
>> -	struct mlx4_spec_list *spec_l3 = NULL;
>> -	struct mlx4_spec_list *spec_l4 = NULL;
>> +	struct mlx4_spec_list *spec_l2;
>> +	struct mlx4_spec_list *spec_l3;
>> +	struct mlx4_spec_list *spec_l4;
>>  	struct ethtool_tcpip4_spec *l4_mask = &cmd->fs.m_u.tcp_ip4_spec;
>>  
>>  	spec_l2 = kzalloc(sizeof(*spec_l2), GFP_KERNEL);
> 
> I suggest if you want to have these kind of changes committed you spend
> more time to make a detailed commit message and explain what's going on
> for the change as otherwise it's not going to be accepted.

Thank you very much! I'll give more explain in future patches.

> 
> 
> 

      reply	other threads:[~2023-08-02  2:35 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
2023-08-02  2:27   ` Ruan Jinjie
2023-08-01 17:55 ` Jesse Brandeburg
2023-08-02  2:35   ` Ruan Jinjie [this message]

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=4f2336ed-7fb2-b720-b2f1-d65e4e2e46fc@huawei.com \
    --to=ruanjinjie@huawei.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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