Message ID | 20240829023654.20884-1-jiapeng.chong@linux.alibaba.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [-next] drm/amd/display: Remove the redundant else if branch in the function amdgpu_dm_init() | expand |
On Wed, Aug 28, 2024 at 10:37 PM Jiapeng Chong <jiapeng.chong@linux.alibaba.com> wrote: > > 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 > > ./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 <abaci@linux.alibaba.com> > Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9829 > Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> > --- > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > index e14c0c060e1b..71624917c475 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > @@ -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 >
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index e14c0c060e1b..71624917c475 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -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;
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). Reported-by: Abaci Robot <abaci@linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9829 Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)