[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8de0c0ea-d81c-402a-a5c4-7779a190c306@kadam.mountain>
Date: Tue, 17 Oct 2023 07:14:47 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Andi Shyti <andi.shyti@...ux.intel.com>
Cc: Greg KH <gregkh@...uxfoundation.org>,
Gilbert Adikankwu <gilbertadikankwu@...il.com>,
outreachy@...ts.linux.dev, linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: emxx_udc: Remove unnecessary parentheses around
condition tests
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
Powered by blists - more mailing lists