drm/amd/display: Remove the redundant else if branch in the function amdgpu_dm_init()
Subsystems (3)
PATCH 1/1 drm/amd/display: Remove the redundant else if branch in the function amdgpu_dm_init()
The assignment of the else and if else branches is the same, so we remove it and add comments here to make the code easier to understand.
./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:1871:6-8: WARNING: possible condition with no effect (if == else).
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1 -3
@@ -1868,9 +1868,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) init_data.flags.disable_ips =DMUB_IPS_DISABLE_DYNAMIC ; else if (amdgpu_dc_debug_mask & DC_DISABLE_IPS2_DYNAMIC) init_data.flags.disable_ips = DMUB_IPS_RCG_IN_ACTIVE_IPS2_IN_OFF; - else if (amdgpu_dc_debug_mask & DC_FORCE_IPS_ENABLE) - init_data.flags.disable_ips = DMUB_IPS_ENABLE; - else + else /* The branch cover "else if (amdgpu_dc_debug_mask & DC_FORCE_IPS_ENABLE)" */ init_data.flags.disable_ips = DMUB_IPS_ENABLE; init_data.flags.disable_ips_in_vpb =0 ;
Signature · 1 line
2.32.0.3.g01195cf9f
Quoted 3 lines · Jiapeng Chong
The assignment of the else and if else branches is the same, so we remove it and add comments here to make the code easier to understand.
I think the code is clearer as is. If you force IPS on, you want to make sure it's enabled, regardless of what the default ends up being in the else case.
Alex
Quoted 28 lines
./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:1871:6-8: WARNING: possible condition with no effect (if == else).
Reported-by Abaci Robot <[email protected]>Signed-off-by Jiapeng Chong <[email protected]>--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +1
-4@@ -1868,9 +1868,7 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) init_data.flags.disable_ips =DMUB_IPS_DISABLE_DYNAMIC ; else if (amdgpu_dc_debug_mask & DC_DISABLE_IPS2_DYNAMIC) init_data.flags.disable_ips = DMUB_IPS_RCG_IN_ACTIVE_IPS2_IN_OFF; - else if (amdgpu_dc_debug_mask & DC_FORCE_IPS_ENABLE) - init_data.flags.disable_ips = DMUB_IPS_ENABLE; - else + else /* The branch cover "else if (amdgpu_dc_debug_mask & DC_FORCE_IPS_ENABLE)" */ init_data.flags.disable_ips = DMUB_IPS_ENABLE; init_data.flags.disable_ips_in_vpb =0 ; --2.32.0.3.g01195cf9f