From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============5443978141639144295==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix minmax.cocci warnings Date: Fri, 15 Apr 2022 23:58:43 +0800 Message-ID: In-Reply-To: <202204152331.CNYw6vJn-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============5443978141639144295== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org BCC: lkp(a)intel.com CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Evan Quan CC: Alex Deucher CC: "Christian K=C3=B6nig" CC: David Airlie CC: Daniel Vetter CC: amd-gfx(a)lists.freedesktop.org CC: dri-devel(a)lists.freedesktop.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c:348:85-86: WARNING op= portunity for max() drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c:351:52-53: WARNING op= portunity 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: 028192fea1de083f4f12bfb1eb7c4d7beb5c8ecd commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minm= ax script :::::: branch date: 17 hours ago :::::: commit date: 12 months ago Please take the patch only if it's a positive warning. Thanks! drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c +++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c @@ -345,12 +345,10 @@ static int vega10_odn_initial_default_se odn_table->min_vddc =3D dep_table[0]->entries[0].vddc; = i =3D od_table[2]->count - 1; - od_table[2]->entries[i].clk =3D hwmgr->platform_descriptor.overdriveLimit= .memoryClock > od_table[2]->entries[i].clk ? - hwmgr->platform_descriptor.overdriveLimit.memoryClock : - od_table[2]->entries[i].clk; - od_table[2]->entries[i].vddc =3D odn_table->max_vddc > od_table[2]->entri= es[i].vddc ? - odn_table->max_vddc : - od_table[2]->entries[i].vddc; + od_table[2]->entries[i].clk =3D max(hwmgr->platform_descriptor.overdriveL= imit.memoryClock, + od_table[2]->entries[i].clk); + od_table[2]->entries[i].vddc =3D max(odn_table->max_vddc, + od_table[2]->entries[i].vddc); = return 0; } --===============5443978141639144295==--