Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: vuhuong@mellanox.com
Cc: linux-rdma@vger.kernel.org
Subject: [bug report] net/mlx5: E-Switch, Refactor eswitch ingress acl codes
Date: Mon, 2 Nov 2020 11:32:48 +0300	[thread overview]
Message-ID: <20201102083248.GA194043@mwanda> (raw)

Hello Vu Pham,

The patch 07bab9502641: "net/mlx5: E-Switch, Refactor eswitch ingress
acl codes" from Mar 27, 2020, leads to the following static checker
warning:

	drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c:184 esw_acl_ingress_lgcy_setup()
	warn: passing zero to 'PTR_ERR'

drivers/net/ethernet/mellanox/mlx5/core/esw/acl/ingress_lgcy.c
  163          if (MLX5_CAP_ESW_INGRESS_ACL(esw->dev, flow_counter)) {
   164                  counter = mlx5_fc_create(esw->dev, false);
   165                  if (IS_ERR(counter)) {
   166                          esw_warn(esw->dev,
   167                                   "vport[%d] configure ingress drop rule counter failed\n",
   168                                   vport->vport);
   169                          counter = NULL;
   170                  }
   171                  vport->ingress.legacy.drop_counter = counter;
   172          }
   173  
   174          if (!vport->info.vlan && !vport->info.qos && !vport->info.spoofchk) {
   175                  esw_acl_ingress_lgcy_cleanup(esw, vport);
   176                  return 0;
   177          }
   178  
   179          if (!vport->ingress.acl) {
   180                  vport->ingress.acl = esw_acl_table_create(esw, vport->vport,
   181                                                            MLX5_FLOW_NAMESPACE_ESW_INGRESS,
   182                                                            table_size);
   183                  if (IS_ERR_OR_NULL(vport->ingress.acl)) {
   184                          err = PTR_ERR(vport->ingress.acl);
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
esw_acl_table_create() doesn't return NULL, but if it did that would
mean "err = 0;" (ie.  The success path).

When a function returns both error pointers and NULL then the NULL
return is meant to be an optional thing where the feature has been
manually disabled by the admin or by the kernel config.

   185                          vport->ingress.acl = NULL;
   186                          return err;
   187                  }
   188  
   189                  err = esw_acl_ingress_lgcy_groups_create(esw, vport);
   190                  if (err)
   191                          goto out;
   192          }
   193  
   194          esw_debug(esw->dev,
   195                    "vport[%d] configure ingress rules, vlan(%d) qos(%d)\n",
   196                    vport->vport, vport->info.vlan, vport->info.qos);

regards,
dan carpenter

                 reply	other threads:[~2020-11-02  8:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20201102083248.GA194043@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=vuhuong@mellanox.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