Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [bug report] net/mlx5: E-Switch, Refactor eswitch ingress acl codes
@ 2020-11-02  8:32 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2020-11-02  8:32 UTC (permalink / raw)
  To: vuhuong; +Cc: linux-rdma

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-02  8:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-02  8:32 [bug report] net/mlx5: E-Switch, Refactor eswitch ingress acl codes Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox