From: Julia Lawall <julia.lawall@inria.fr>
To: Jan Kara <jack@suse.cz>
Cc: Amir Goldstein <amir73il@gmail.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
kbuild-all@lists.01.org, Denis Efremov <efremov@linux.com>
Subject: Re: [PATCH] inotify: fix minmax.cocci warnings
Date: Wed, 7 Apr 2021 19:02:53 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.22.394.2104071901260.11549@hadrien> (raw)
In-Reply-To: <20210407160546.GA3271@quack2.suse.cz>
On Wed, 7 Apr 2021, Jan Kara wrote:
> On Tue 06-04-21 22:49:26, Julia Lawall wrote:
> > From: kernel test robot <lkp@intel.com>
> >
> > Opportunity for min().
> >
> > Generated by: scripts/coccinelle/misc/minmax.cocci
> >
> > Fixes: 8636e3295ce3 ("coccinelle: misc: add minmax script")
> > CC: Denis Efremov <efremov@linux.com>
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
> ...
> > --- a/fs/notify/inotify/inotify_user.c
> > +++ b/fs/notify/inotify/inotify_user.c
> > @@ -382,7 +382,7 @@ static int inotify_add_to_idr(struct idr
> >
> > spin_unlock(idr_lock);
> > idr_preload_end();
> > - return ret < 0 ? ret : 0;
> > + return min(ret, 0);
> > }
>
> Honestly, while previous expression is a standard idiom for "if 'ret' holds
> an error, return it", the new expression is harder to understand for me. So
> I prefer to keep things as they are in this particular case...
OK, I had doubts about it as well, but I forwarded it because I found them
equally obscure...
Denis, maybe the semantic patch should be updated to avoid this case.
julia
next prev parent reply other threads:[~2021-04-07 17:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-06 20:49 Julia Lawall
2021-04-07 16:05 ` Jan Kara
2021-04-07 17:02 ` Julia Lawall [this message]
2021-04-08 6:22 ` Denis Efremov
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=alpine.DEB.2.22.394.2104071901260.11549@hadrien \
--to=julia.lawall@inria.fr \
--cc=amir73il@gmail.com \
--cc=efremov@linux.com \
--cc=jack@suse.cz \
--cc=kbuild-all@lists.01.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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®