From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============3295742146910126090==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Wed, 16 Feb 2022 21:22:55 +0800 Message-ID: <20220216132255.GA15966@f01d22c8e319> In-Reply-To: <202202162112.MZ4DRKk2-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============3295742146910126090== 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: Ingo Molnar CC: Borislav Petkov CC: x86(a)kernel.org CC: "H. Peter Anvin" CC: linux-kernel(a)vger.kernel.org From: kernel test robot arch/x86/kernel/apic/ipi.c:329:14-16: 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: c5d9ae265b105d9a67575fb67bd4650a6fc08e25 commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 18 hours ago :::::: commit date: 10 months ago Please take the patch only if it's a positive warning. Thanks! arch/x86/kernel/apic/ipi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/kernel/apic/ipi.c +++ b/arch/x86/kernel/apic/ipi.c @@ -326,6 +326,6 @@ int safe_smp_processor_id(void) = cpuid =3D convert_apicid_to_cpu(apicid); = - return cpuid >=3D 0 ? cpuid : 0; + return max(cpuid, 0); } #endif --===============3295742146910126090==--