From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============0443103738578149595==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Tue, 06 Apr 2021 21:17:53 +0800 Message-ID: <20210406131753.GA14932@2a9e44bebf79> In-Reply-To: <202104062109.XUgtOwRm-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============0443103738578149595== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org TO: Denis Efremov CC: Julia Lawall CC: Jan Kara CC: Amir Goldstein CC: linux-fsdevel(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot fs/notify/inotify/inotify_user.c:385:12-13: WARNING opportunity for min() Check for opencoded min(), max() implementations. Generated patches sometimes require adding a cast to fix compile warning. Warnings/patches scope intentionally limited to a function body. 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 --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux.git f= or-5.12 head: cbc8ed0b4f7eeb782c153ec88d6d20bc0f0ca3a7 commit: 8636e3295ce33515c50ef728f0ff3800d97f9f44 [1/4] coccinelle: misc: ad= d minmax script :::::: branch date: 2 days ago :::::: commit date: 2 weeks ago Please take the patch only if it's a positive warning. Thanks! inotify_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 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); } = static struct inotify_inode_mark *inotify_idr_find_locked(struct fsnotify_= group *group, --===============0443103738578149595==--