From: Jason Gunthorpe <jgg@nvidia.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Selvin Xavier <selvin.xavier@broadcom.com>,
Devesh Sharma <devesh.sharma@broadcom.com>,
Doug Ledford <dledford@redhat.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/bnxt_re: Drop unnecessary NULL checks after container_of
Date: Thu, 20 May 2021 12:02:39 -0300 [thread overview]
Message-ID: <20210520150239.GC2734122@nvidia.com> (raw)
In-Reply-To: <20210514153606.1377119-1-linux@roeck-us.net>
On Fri, May 14, 2021 at 08:36:06AM -0700, Guenter Roeck wrote:
> 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
> ...+>
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/infiniband/hw/bnxt_re/ib_verbs.c | 18 ------------------
> drivers/infiniband/hw/bnxt_re/main.c | 12 ------------
> 2 files changed, 30 deletions(-)
Applied to for-next, thanks
Jason
prev parent reply other threads:[~2021-05-20 15:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-14 15:36 [PATCH] RDMA/bnxt_re: Drop unnecessary NULL checks after container_of Guenter Roeck
2021-05-20 15:02 ` Jason Gunthorpe [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=20210520150239.GC2734122@nvidia.com \
--to=jgg@nvidia.com \
--cc=devesh.sharma@broadcom.com \
--cc=dledford@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=selvin.xavier@broadcom.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