RDMA/bnxt_re: Drop unnecessary NULL checks after container_of
authorGuenter Roeck <linux@roeck-us.net>
Fri, 14 May 2021 15:36:06 +0000 (08:36 -0700)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 20 May 2021 15:01:00 +0000 (12:01 -0300)
commit6dc760027d29364aab77e3c57f0e04a4e82476e9
tree90f37fe915ac235353e992fdef89aa56d00c2b30
parentcd5b010ffff2652cf6b153d9e796f4e3b90aebb6
RDMA/bnxt_re: Drop unnecessary NULL checks after container_of

The result of container_of() operations is never NULL unless the first
element of the embedding structure is extracted. This is either not the
case here, or the pointer passed to container_of() is known to be not
NULL. The NULL checks are therefore unnecessary and misleading.
Remove them.

The channges in this patch were made automatically with the following
Coccinelle script.

@@
type t;
identifier v;
statement s;
@@

<+...
(
  t v = container_of(...);
|
  v = container_of(...);
)
  ...
  when != v
- if (\( !v \| v == NULL \) ) s
...+>

Link: https://lore.kernel.org/r/20210514153606.1377119-1-linux@roeck-us.net
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/bnxt_re/ib_verbs.c
drivers/infiniband/hw/bnxt_re/main.c