From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============7257509673567601395==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Fri, 30 Apr 2021 02:06:59 +0800 Message-ID: <20210429180659.GA38486@698e760dc838> In-Reply-To: <202104300243.iR3ktOsZ-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============7257509673567601395== 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: Catalin Marinas CC: Will Deacon CC: Suzuki K Poulose CC: Anshuman Khandual CC: Marc Zyngier CC: Mark Rutland CC: Amit Daniel Kachhap CC: linux-arm-kernel(a)lists.infradead.org From: kernel test robot arch/arm64/kernel/cpufeature.c:705:12-13: WARNING opportunity for max() arch/arm64/kernel/cpufeature.c:698: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: 44e793b89bcfe586730f4c6ce3c66174dc07cb37 commit: 8636e3295ce33515c50ef728f0ff3800d97f9f44 [1/5] coccinelle: misc: ad= d minmax script :::::: branch date: 6 days ago :::::: commit date: 6 weeks ago Please take the patch only if it's a positive warning. Thanks! cpufeature.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -695,14 +695,14 @@ static s64 arm64_ftr_safe_value(const st ret =3D ftrp->safe_val; break; case FTR_LOWER_SAFE: - ret =3D new < cur ? new : cur; + ret =3D min(new, cur); break; case FTR_HIGHER_OR_ZERO_SAFE: if (!cur || !new) break; fallthrough; case FTR_HIGHER_SAFE: - ret =3D new > cur ? new : cur; + ret =3D max(new, cur); break; default: BUG(); --===============7257509673567601395==--