public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: YueHaibing <yuehaibing@huawei.com>
To: Roi Dayan <roid@nvidia.com>, <saeedm@nvidia.com>,
	<leon@kernel.org>, <davem@davemloft.net>, <edumazet@google.com>,
	<kuba@kernel.org>, <pabeni@redhat.com>, <kliteyn@nvidia.com>,
	<mbloch@nvidia.com>, <valex@nvidia.com>, <erezsh@mellanox.com>
Cc: <netdev@vger.kernel.org>, <linux-rdma@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] net/mlx5: DR, Fix uninitialized var warning
Date: Thu, 10 Nov 2022 19:06:23 +0800	[thread overview]
Message-ID: <f7411744-4033-9a06-fe96-428ae5bd7e21@huawei.com> (raw)
In-Reply-To: <b464b0af-69a3-ffc9-41f6-3d93f9bc32ce@nvidia.com>

On 2022/11/10 16:20, Roi Dayan wrote:
> 
> 
> On 08/11/2022 3:53, YueHaibing wrote:
>> Smatch warns this:
>>
>> drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c:81
>>  mlx5dr_table_set_miss_action() error: uninitialized symbol 'ret'.
>>
>> Fix this by initializing ret with zero.
>>
>> Fixes: 7838e1725394 ("net/mlx5: DR, Expose steering table functionality")
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>>  drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c
>> index 31d443dd8386..44dea75dabde 100644
>> --- a/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c
>> +++ b/drivers/net/ethernet/mellanox/mlx5/core/steering/dr_table.c
>> @@ -46,7 +46,7 @@ static int dr_table_set_miss_action_nic(struct mlx5dr_domain *dmn,
>>  int mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl,
>>  				 struct mlx5dr_action *action)
>>  {
>> -	int ret;
>> +	int ret = 0;
>>  
>>  	if (action && action->action_type != DR_ACTION_TYP_FT)
>>  		return -EOPNOTSUPP;
> 
> 
> In this case the default should be an error
> It will be better if ret init to -EOPNOTSUPP and if
> a miss action was not set and replaces ret then goto out.

Thanks for your review, will do that in v2.

> 
>  int mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl,
>                                  struct mlx5dr_action *action)
>  {
> -       int ret;
> +       int ret = -EOPNOTSUPP;
>  
>         if (action && action->action_type != DR_ACTION_TYP_FT)
>                 return -EOPNOTSUPP;
> @@ -67,6 +67,9 @@ int mlx5dr_table_set_miss_action(struct mlx5dr_table *tbl,
>                         goto out;
>         }
>  
> +       if (ret)
> +               goto out;
> +
> 
> .
> 

      reply	other threads:[~2022-11-10 11:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08  1:53 [PATCH net] net/mlx5: DR, Fix uninitialized var warning YueHaibing
2022-11-10  8:20 ` Roi Dayan
2022-11-10 11:06   ` YueHaibing [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=f7411744-4033-9a06-fe96-428ae5bd7e21@huawei.com \
    --to=yuehaibing@huawei.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=erezsh@mellanox.com \
    --cc=kliteyn@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=roid@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=valex@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