From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Felipe Balbi <balbi@kernel.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of
Date: Sun, 25 Apr 2021 01:07:42 +0300 [thread overview]
Message-ID: <YISWrhfxH0hHLkfl@pendragon.ideasonboard.com> (raw)
In-Reply-To: <87v98ckt2w.fsf@kernel.org>
Hi Guenter,
On Sat, Apr 24, 2021 at 11:03:19AM +0300, Felipe Balbi wrote:
> Guenter Roeck <linux@roeck-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@ideasonboard.com>
> > Cc: Felipe Balbi <balbi@kernel.org>
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Guenter Roeck <linux@roeck-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@kernel.org>
Likewise,
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
And thank you for the patch.
--
Regards,
Laurent Pinchart
prev parent reply other threads:[~2021-04-24 22:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 15:06 [RFC PATCH] usb: gadget: Drop unnecessary NULL checks after container_of Guenter Roeck
2021-04-24 6:01 ` Greg Kroah-Hartman
2021-04-24 8:03 ` Felipe Balbi
2021-04-24 22:07 ` Laurent Pinchart [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=YISWrhfxH0hHLkfl@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
/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