[PATCH] drm/amd/pm: replace ternary operator with max()
From: wangkailong
Date: Sat Oct 29 2022 - 11:36:24 EST
Fix the following coccicheck warning:
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c:348:85-86:
WARNING opportunity for max()
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c:351:52-53:
WARNING opportunity for max()
Signed-off-by: KaiLong Wang <wangkailong@xxxxxxx>
---
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_hwmgr.c
index c8c9fb827bda..35677c13ddf9 100644
--- 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,8 @@ static int vega10_odn_initial_default_setting(struct pp_hwmgr *hwmgr)
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;
}
--
2.25.1