[PATCH] drm/amd/display: Remove redundant code and semicolons

Alex Deucher alexdeucher at gmail.com
Thu Jun 20 17:21:51 UTC 2024


On Thu, Jun 20, 2024 at 1:18 PM David Wu <davidwu2 at amd.com> wrote:
>
> see inline, please
> David
>
> On 2024-06-20 12:50, Alex Deucher wrote:
> > On Thu, Jun 20, 2024 at 12:07 PM David Wu <davidwu2 at amd.com> wrote:
> >> I think the "break;" there is to silence the compilation warning - it is
> >> ugly but needed.
> > Which break?  It looks fine to me.
> example here - code is fine but the compiler will complain about missing
> "break" for case statement.
>
> -               return 256; break;
> +               return 256;

It shouldn't.  Actually a number of checkers will complain about
having a break after a return.

Alex

>
> >
> > Alex
> >
> >> David
> >>
> >> On 2024-06-20 11:38, Alex Deucher wrote:
> >>> Applied.  Thanks!
> >>>
> >>> Alex
> >>>
> >>> On Thu, Jun 20, 2024 at 5:07 AM Jiapeng Chong
> >>> <jiapeng.chong at linux.alibaba.com> wrote:
> >>>> No functional modification involved.
> >>>>
> >>>> ./drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_shared.c:3171:2-3: Unneeded semicolon.
> >>>> ./drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_shared.c:3185:2-3: Unneeded semicolon.
> >>>> ./drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_shared.c:3200:2-3: Unneeded semicolon.
> >>>>
> >>>> Reported-by: Abaci Robot <abaci at linux.alibaba.com>
> >>>> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9365
> >>>> Signed-off-by: Jiapeng Chong <jiapeng.chong at linux.alibaba.com>
> >>>> ---
> >>>>    .../dml21/src/dml2_core/dml2_core_shared.c    | 46 +++++++++----------
> >>>>    1 file changed, 23 insertions(+), 23 deletions(-)
> >>>>
> >>>> diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_shared.c b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_shared.c
> >>>> index cfa4c4475821..1a9895b1833f 100644
> >>>> --- a/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_shared.c
> >>>> +++ b/drivers/gpu/drm/amd/display/dc/dml2/dml21/src/dml2_core/dml2_core_shared.c
> >>>> @@ -3142,62 +3142,62 @@ static unsigned int dml_get_tile_block_size_bytes(enum dml2_swizzle_mode sw_mode
> >>>>    {
> >>>>           switch (sw_mode) {
> >>>>           case (dml2_sw_linear):
> >>>> -               return 256; break;
> >>>> +               return 256;
> >>>>           case (dml2_sw_256b_2d):
> >>>> -               return 256; break;
> >>>> +               return 256;
> >>>>           case (dml2_sw_4kb_2d):
> >>>> -               return 4096; break;
> >>>> +               return 4096;
> >>>>           case (dml2_sw_64kb_2d):
> >>>> -               return 65536; break;
> >>>> +               return 65536;
> >>>>           case (dml2_sw_256kb_2d):
> >>>> -               return 262144; break;
> >>>> +               return 262144;
> >>>>           case (dml2_gfx11_sw_linear):
> >>>> -               return 256; break;
> >>>> +               return 256;
> >>>>           case (dml2_gfx11_sw_64kb_d):
> >>>> -               return 65536; break;
> >>>> +               return 65536;
> >>>>           case (dml2_gfx11_sw_64kb_d_t):
> >>>> -               return 65536; break;
> >>>> +               return 65536;
> >>>>           case (dml2_gfx11_sw_64kb_d_x):
> >>>> -               return 65536; break;
> >>>> +               return 65536;
> >>>>           case (dml2_gfx11_sw_64kb_r_x):
> >>>> -               return 65536; break;
> >>>> +               return 65536;
> >>>>           case (dml2_gfx11_sw_256kb_d_x):
> >>>> -               return 262144; break;
> >>>> +               return 262144;
> >>>>           case (dml2_gfx11_sw_256kb_r_x):
> >>>> -               return 262144; break;
> >>>> +               return 262144;
> >>>>           default:
> >>>>                   DML2_ASSERT(0);
> >>>>                   return 256;
> >>>> -       };
> >>>> +       }
> >>>>    }
> >>>>
> >>>>    const char *dml2_core_internal_bw_type_str(enum dml2_core_internal_bw_type bw_type)
> >>>>    {
> >>>>           switch (bw_type) {
> >>>>           case (dml2_core_internal_bw_sdp):
> >>>> -               return("dml2_core_internal_bw_sdp"); break;
> >>>> +               return("dml2_core_internal_bw_sdp");
> >>>>           case (dml2_core_internal_bw_dram):
> >>>> -               return("dml2_core_internal_bw_dram"); break;
> >>>> +               return("dml2_core_internal_bw_dram");
> >>>>           case (dml2_core_internal_bw_max):
> >>>> -               return("dml2_core_internal_bw_max"); break;
> >>>> +               return("dml2_core_internal_bw_max");
> >>>>           default:
> >>>> -               return("dml2_core_internal_bw_unknown"); break;
> >>>> -       };
> >>>> +               return("dml2_core_internal_bw_unknown");
> >>>> +       }
> >>>>    }
> >>>>
> >>>>    const char *dml2_core_internal_soc_state_type_str(enum dml2_core_internal_soc_state_type dml2_core_internal_soc_state_type)
> >>>>    {
> >>>>           switch (dml2_core_internal_soc_state_type) {
> >>>>           case (dml2_core_internal_soc_state_sys_idle):
> >>>> -               return("dml2_core_internal_soc_state_sys_idle"); break;
> >>>> +               return("dml2_core_internal_soc_state_sys_idle");
> >>>>           case (dml2_core_internal_soc_state_sys_active):
> >>>> -               return("dml2_core_internal_soc_state_sys_active"); break;
> >>>> +               return("dml2_core_internal_soc_state_sys_active");
> >>>>           case (dml2_core_internal_soc_state_svp_prefetch):
> >>>> -               return("dml2_core_internal_soc_state_svp_prefetch"); break;
> >>>> +               return("dml2_core_internal_soc_state_svp_prefetch");
> >>>>           case dml2_core_internal_soc_state_max:
> >>>>           default:
> >>>> -               return("dml2_core_internal_soc_state_unknown"); break;
> >>>> -       };
> >>>> +               return("dml2_core_internal_soc_state_unknown");
> >>>> +       }
> >>>>    }
> >>>>
> >>>>    static bool dml_is_vertical_rotation(enum dml2_rotation_angle Scan)
> >>>> --
> >>>> 2.20.1.7.g153144c
> >>>>


More information about the amd-gfx mailing list