[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAFX7JTfWdaGra+kWBJt-GXVVO601K03qWnExFKFD_9vxS-03g@mail.gmail.com>
Date: Thu, 29 Mar 2018 21:03:45 +0530
From: Varsha Rao <rvarsha016@...il.com>
To: Joe Perches <joe@...ches.com>
Cc: Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
cocci <cocci@...teme.lip6.fr>
Subject: Re: [PATCH] crypto: cavium: zip: Remove unnecessary parentheses
On Wed, Mar 28, 2018 at 11:41 PM, Joe Perches wrote:
>
> On Wed, 2018-03-28 at 23:27, Varsha Rao wrote:
> > This patch fixes the clang warning of extraneous parentheses, with the
> > following coccinelle script.
> >
> > @@
> > identifier i;
> > constant c;
> > @@
> > (
> > -((i == c))
> > +i == c
> > >
> >
> > -((i <= c))
> > +i <= c
>
> Why just the "==" and "<=" cases?
> Why not "<", ">" and ">=" too?
>
> Why not expression instead of constant?
Initially I had the other cases too and used expression instead of
constant. But the results included only "==" and "<=" cases with
constant. Along with one false positive case.
--- a/drivers/crypto/cavium/zip/zip_main.c
+++ b/drivers/crypto/cavium/zip/zip_main.c
@@ -99,7 +99,7 @@ static struct zip_device *zip_alloc_devi
*/
struct zip_device *zip_get_device(int node)
{
- if ((node < MAX_ZIP_DEVICES) && (node >= 0))
+ if (node < MAX_ZIP_DEVICES && node >= 0)
return zip_dev[node];
zip_err("ZIP device not found for node id %d\n", node);
I checked if there was any case of extra parentheses around relational
operators left, but there were none. Hence, in the script I included
only the cases present in the result.
Thanks,
Varsha
Powered by blists - more mailing lists