From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============9149642129085191168==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Wed, 23 Feb 2022 21:07:22 +0800 Message-ID: <20220223130722.GA55574@a647849c00b9> In-Reply-To: <202202232117.F13tHPz0-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============9149642129085191168== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Thomas Gleixner CC: linux-kernel(a)vger.kernel.org From: kernel test robot kernel/time/clockevents.c:75:12-13: WARNING opportunity for max() 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 CC: Denis Efremov Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git = master head: 5c1ee569660d4a205dced9cb4d0306b907fb7599 commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 13 hours ago :::::: commit date: 10 months ago Please take the patch only if it's a positive warning. Thanks! kernel/time/clockevents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -72,7 +72,7 @@ static u64 cev_delta2ns(unsigned long la do_div(clc, evt->mult); = /* Deltas less than 1usec are pointless noise */ - return clc > 1000 ? clc : 1000; + return max(clc, 1000); } = /** --===============9149642129085191168==--