From: Denis Efremov <efremov@linux.com>
To: Julia Lawall <julia.lawall@inria.fr>, 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
Subject: Re: [PATCH] inotify: fix minmax.cocci warnings
Date: Thu, 8 Apr 2021 09:22:02 +0300 [thread overview]
Message-ID: <bd17554f-a8d8-3fd8-b3b6-e3c2d86d7f99@linux.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2104071901260.11549@hadrien>
On 4/7/21 8:02 PM, Julia Lawall wrote:
>
>
> 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.
No problem, I'll send an update.
Thanks,
Denis
prev parent reply other threads:[~2021-04-08 6:22 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
2021-04-07 17:02 ` Julia Lawall
2021-04-08 6:22 ` Denis Efremov [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=bd17554f-a8d8-3fd8-b3b6-e3c2d86d7f99@linux.com \
--to=efremov@linux.com \
--cc=amir73il@gmail.com \
--cc=jack@suse.cz \
--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).