Content-Type: multipart/mixed; boundary="===============8449280981597138020==" MIME-Version: 1.0 From: Jan Kara To: kbuild-all@lists.01.org Subject: Re: [PATCH] inotify: fix minmax.cocci warnings Date: Wed, 07 Apr 2021 18:05:46 +0200 Message-ID: <20210407160546.GA3271@quack2.suse.cz> In-Reply-To: List-Id: --===============8449280981597138020== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Tue 06-04-21 22:49:26, Julia Lawall wrote: > From: kernel test robot > = > Opportunity for min(). > = > Generated by: scripts/coccinelle/misc/minmax.cocci > = > Fixes: 8636e3295ce3 ("coccinelle: misc: add minmax script") > CC: Denis Efremov > Reported-by: kernel test robot > Signed-off-by: kernel test robot > Signed-off-by: Julia Lawall ... > --- 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 SUSE Labs, CR --===============8449280981597138020==--