[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YISWrhfxH0hHLkfl@pendragon.ideasonboard.com>
Date: Sun, 25 Apr 2021 01:07:42 +0300
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Felipe Balbi <balbi@...nel.org>, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after
container_of
Hi Guenter,
On Sat, Apr 24, 2021 at 11:03:19AM +0300, Felipe Balbi wrote:
> Guenter Roeck <linux@...ck-us.net> writes:
> > The parameters passed to allow_link and drop_link functions are never NULL.
> > That means the result of container_of() on those parameters is also
> > never NULL, even if the reference into the structure points to the first
> > element of the structure. Remove the subsequent NULL checks.
> >
> > The changes in this patch were made automatically using the following
> > Coccinelle script.
> >
> > @@
> > type t;
> > identifier v;
> > statement s;
> > @@
> >
> > <+...
> > (
> > t v = container_of(...);
> > |
> > v = container_of(...);
> > )
> > ...
> > when != v
> > - if (\( !v \| v == NULL \) ) s
> > ...+>
> >
> > Cc: Laurent Pinchart <laurent.pinchart@...asonboard.com>
> > Cc: Felipe Balbi <balbi@...nel.org>
> > Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> > Signed-off-by: Guenter Roeck <linux@...ck-us.net>
> > ---
> > After the recent discussion about a patch which tried to add a check
> > against NULL after container_of(), I realized that there are a number
> > of such checks in the kernel.
> >
> > Now the big question: Are patches like this acceptable, or do they count
> > as noise ?
>
> Not noise in my book :-)
>
> Acked-by: Felipe Balbi <balbi@...nel.org>
Likewise,
Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
And thank you for the patch.
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists