* [PATCH] drm/amdgpu/powerplay/vega10: fix minmax.cocci warnings
@ 2022-04-16 15:41 Julia Lawall
2022-04-19 15:06 ` Alex Deucher
0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2022-04-16 15:41 UTC (permalink / raw)
To: kbuild-all, lkp, linux-kernel, Denis Efremov, Julia Lawall,
Evan Quan, Alex Deucher, Christian König, David Airlie,
Daniel Vetter, amd-gfx, dri-devel, linux-kernel
From: kernel test robot <lkp@intel.com>
Use max to simplify the code.
Generated by: scripts/coccinelle/misc/minmax.cocci
CC: Denis Efremov <efremov@linux.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 028192fea1de083f4f12bfb1eb7c4d7beb5c8ecd
commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minmax 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 = dep_table[0]->entries[0].vddc;
i = od_table[2]->count - 1;
- od_table[2]->entries[i].clk = 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 = odn_table->max_vddc > od_table[2]->entries[i].vddc ?
- odn_table->max_vddc :
- od_table[2]->entries[i].vddc;
+ od_table[2]->entries[i].clk = max(hwmgr->platform_descriptor.overdriveLimit.memoryClock,
+ od_table[2]->entries[i].clk);
+ od_table[2]->entries[i].vddc = max(odn_table->max_vddc,
+ od_table[2]->entries[i].vddc);
return 0;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amdgpu/powerplay/vega10: fix minmax.cocci warnings
2022-04-16 15:41 [PATCH] drm/amdgpu/powerplay/vega10: fix minmax.cocci warnings Julia Lawall
@ 2022-04-19 15:06 ` Alex Deucher
0 siblings, 0 replies; 2+ messages in thread
From: Alex Deucher @ 2022-04-19 15:06 UTC (permalink / raw)
To: Julia Lawall
Cc: kbuild-all, kernel test robot, LKML, Denis Efremov, Evan Quan,
Alex Deucher, Christian König, David Airlie, Daniel Vetter,
amd-gfx list, Maling list - DRI developers
On Sat, Apr 16, 2022 at 11:41 AM Julia Lawall <julia.lawall@inria.fr> wrote:
>
> From: kernel test robot <lkp@intel.com>
>
> Use max to simplify the code.
>
> Generated by: scripts/coccinelle/misc/minmax.cocci
>
> CC: Denis Efremov <efremov@linux.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
This introduces a type comparison warning:
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/vega10_hwmgr.c: In
function ‘vega10_odn_initial_default_setting’:
./include/linux/minmax.h:20:35: warning: comparison of distinct
pointer types lacks a cast
20 | (!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
| ^~
./include/linux/minmax.h:26:18: note: in expansion of macro ‘__typecheck’
26 | (__typecheck(x, y) && __no_side_effects(x, y))
| ^~~~~~~~~~~
./include/linux/minmax.h:36:31: note: in expansion of macro ‘__safe_cmp’
36 | __builtin_choose_expr(__safe_cmp(x, y), \
| ^~~~~~~~~~
./include/linux/minmax.h:52:25: note: in expansion of macro ‘__careful_cmp’
52 | #define max(x, y) __careful_cmp(x, y, >)
| ^~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/vega10_hwmgr.c:350:40:
note: in expansion of macro ‘max’
350 | od_table[2]->entries[i].vddc = max(odn_table->max_vddc,
| ^~~
Alex
>
> ---
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 028192fea1de083f4f12bfb1eb7c4d7beb5c8ecd
> commit: 5f66f73b9ff4dcabd4e2405ba9c32e80e02f9408 coccinelle: misc: add minmax 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 = dep_table[0]->entries[0].vddc;
>
> i = od_table[2]->count - 1;
> - od_table[2]->entries[i].clk = 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 = odn_table->max_vddc > od_table[2]->entries[i].vddc ?
> - odn_table->max_vddc :
> - od_table[2]->entries[i].vddc;
> + od_table[2]->entries[i].clk = max(hwmgr->platform_descriptor.overdriveLimit.memoryClock,
> + od_table[2]->entries[i].clk);
> + od_table[2]->entries[i].vddc = max(odn_table->max_vddc,
> + od_table[2]->entries[i].vddc);
>
> return 0;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-19 15:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-16 15:41 [PATCH] drm/amdgpu/powerplay/vega10: fix minmax.cocci warnings Julia Lawall
2022-04-19 15:06 ` Alex Deucher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).