mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	Gilbert Adikankwu <gilbertadikankwu@gmail.com>,
	outreachy@lists.linux.dev, linux-staging@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: emxx_udc: Remove unnecessary parentheses around condition tests
Date: Tue, 17 Oct 2023 07:14:47 +0300	[thread overview]
Message-ID: <8de0c0ea-d81c-402a-a5c4-7779a190c306@kadam.mountain> (raw)
In-Reply-To: <ZS2qpwnfCxsbvOld@ashyti-mobl2.lan>

On Mon, Oct 16, 2023 at 11:27:03PM +0200, Andi Shyti wrote:
> > > Fix 47 warnings detected by checkpatch.pl about unnecessary parenthesis
> > > around condition tests.
> > 
> > And as I have stated numerous times in the past, they are not
> > "unnecessary" at all, and provide a valuable hint to the developer as to
> > what is the ordering involved.
> > 
> > So you can ignore this checkpatch warning please, it's not valid as far
> > as I'm concerned for the subsystems that I maintain in the kernel.
> 
> I find this very confusing, though:
> 
>    if (((ep->epnum == 0) || (data & (1 << ep->epnum)) == 0))

Yeah.  Too many parens.  It could hide an == vs = bug.  (That happened
once 10 years ago but I still remember it as if it were a useful and
dangerous anti-pattern to remember instead of a getting hit by a meteor
type thing that will never happen again).

Also == 0 should only be used for the number zero (used as a number and
not as a logical no or absence) and for strcmp() functions.

	if ((ep->epnum == 0) || !(data & (1 << ep->epnum)))

regards,
dan carpenter

      reply	other threads:[~2023-10-17  4:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16 11:35 Gilbert Adikankwu
2023-10-16 12:15 ` Julia Lawall
2023-10-16 14:57 ` Greg KH
2023-10-16 21:27   ` Andi Shyti
2023-10-17  4:14     ` Dan Carpenter [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=8de0c0ea-d81c-402a-a5c4-7779a190c306@kadam.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=andi.shyti@linux.intel.com \
    --cc=gilbertadikankwu@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=outreachy@lists.linux.dev \
    /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

all inboxes | Powered by JetHome®