From: Jan Kara <jack@suse.cz>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: Jan Kara <jack@suse.cz>, 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 18:05:46 +0200 [thread overview]
Message-ID: <20210407160546.GA3271@quack2.suse.cz> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2104062246500.19097@hadrien>
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...
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2021-04-07 16:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-06 20:49 [PATCH] inotify: fix minmax.cocci warnings Julia Lawall
2021-04-07 16:05 ` Jan Kara [this message]
2021-04-07 17:02 ` Julia Lawall
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=20210407160546.GA3271@quack2.suse.cz \
--to=jack@suse.cz \
--cc=amir73il@gmail.com \
--cc=efremov@linux.com \
--cc=julia.lawall@inria.fr \
--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;
as well as URLs for NNTP newsgroup(s).