[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210520150239.GC2734122@nvidia.com>
Date: Thu, 20 May 2021 12:02:39 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Selvin Xavier <selvin.xavier@...adcom.com>,
Devesh Sharma <devesh.sharma@...adcom.com>,
Doug Ledford <dledford@...hat.com>, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] RDMA/bnxt_re: Drop unnecessary NULL checks after
container_of
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@...ck-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
Powered by blists - more mailing lists