From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============1754876895437822058==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Thu, 17 Feb 2022 00:13:41 +0800 Message-ID: <20220216161341.GA4858@206707a13740> In-Reply-To: <202202170042.PCOyRvCo-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============1754876895437822058== 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: Zhang Rui CC: "Rafael J. Wysocki" CC: Len Brown CC: linux-acpi(a)vger.kernel.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/acpi/thermal.c:425:43-44: 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 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: 21 hours ago :::::: commit date: 10 months ago Please take the patch only if it's a positive warning. Thanks! drivers/acpi/thermal.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -422,10 +422,8 @@ static int acpi_thermal_trips_update(str * the next higher trip point */ tz->trips.active[i - 1].temperature =3D - (tz->trips.active[i - 2].temperature < - celsius_to_deci_kelvin(act) ? - tz->trips.active[i - 2].temperature : - celsius_to_deci_kelvin(act)); + min(tz->trips.active[i - 2].temperature, + celsius_to_deci_kelvin(act)); break; } else { tz->trips.active[i].temperature =3D tmp; --===============1754876895437822058==--