[PATCH] drm/amdgpu: Assign boolean values to a bool variable

Alex Deucher alexdeucher at gmail.com
Wed Jan 20 22:00:16 UTC 2021


Applied.  Thanks!

Alex

On Wed, Jan 20, 2021 at 10:05 AM Harry Wentland <harry.wentland at amd.com> wrote:
>
> On 2021-01-20 2:16 a.m., Jiapeng Zhong wrote:
> > Fix the following coccicheck warnings:
> >
> > ./drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c:
> > 1009:6-16: WARNING: Assignment of 0/1 to bool variable.
> >
> > ./drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c:
> > 200:2-10: WARNING: Assignment of 0/1 to bool variable.
> >
> > Reported-by: Abaci Robot <abaci at linux.alibaba.com>
> > Signed-off-by: Jiapeng Zhong <abaci-bugfix at linux.alibaba.com>
>
> Reviewed-by: Harry Wentland <harry.wentland at amd.com>
>
> Harry
>
> > ---
> >   .../display/dc/dml/dcn30/display_rq_dlg_calc_30.c  | 32 +++++++++++-----------
> >   1 file changed, 16 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c
> > index 5b5916b..0f14f20 100644
> > --- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c
> > +++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/display_rq_dlg_calc_30.c
> > @@ -165,8 +165,8 @@ static void handle_det_buf_split(struct display_mode_lib *mode_lib,
> >       unsigned int swath_bytes_c = 0;
> >       unsigned int full_swath_bytes_packed_l = 0;
> >       unsigned int full_swath_bytes_packed_c = 0;
> > -     bool req128_l = 0;
> > -     bool req128_c = 0;
> > +     bool req128_l = false;
> > +     bool req128_c = false;
> >       bool surf_linear = (pipe_src_param.sw_mode == dm_sw_linear);
> >       bool surf_vert = (pipe_src_param.source_scan == dm_vert);
> >       unsigned int log2_swath_height_l = 0;
> > @@ -191,37 +191,37 @@ static void handle_det_buf_split(struct display_mode_lib *mode_lib,
> >               total_swath_bytes = 2 * full_swath_bytes_packed_l;
> >
> >       if (total_swath_bytes <= detile_buf_size_in_bytes) { //full 256b request
> > -             req128_l = 0;
> > -             req128_c = 0;
> > +             req128_l = false;
> > +             req128_c = false;
> >               swath_bytes_l = full_swath_bytes_packed_l;
> >               swath_bytes_c = full_swath_bytes_packed_c;
> >       } else if (!rq_param->yuv420) {
> > -             req128_l = 1;
> > -             req128_c = 0;
> > +             req128_l = true;
> > +             req128_c = false;
> >               swath_bytes_c = full_swath_bytes_packed_c;
> >               swath_bytes_l = full_swath_bytes_packed_l / 2;
> >       } else if ((double)full_swath_bytes_packed_l / (double)full_swath_bytes_packed_c < 1.5) {
> > -             req128_l = 0;
> > -             req128_c = 1;
> > +             req128_l = false;
> > +             req128_c = true;
> >               swath_bytes_l = full_swath_bytes_packed_l;
> >               swath_bytes_c = full_swath_bytes_packed_c / 2;
> >
> >               total_swath_bytes = 2 * swath_bytes_l + 2 * swath_bytes_c;
> >
> >               if (total_swath_bytes > detile_buf_size_in_bytes) {
> > -                     req128_l = 1;
> > +                     req128_l = true;
> >                       swath_bytes_l = full_swath_bytes_packed_l / 2;
> >               }
> >       } else {
> > -             req128_l = 1;
> > -             req128_c = 0;
> > +             req128_l = true;
> > +             req128_c = false;
> >               swath_bytes_l = full_swath_bytes_packed_l/2;
> >               swath_bytes_c = full_swath_bytes_packed_c;
> >
> >               total_swath_bytes = 2 * swath_bytes_l + 2 * swath_bytes_c;
> >
> >               if (total_swath_bytes > detile_buf_size_in_bytes) {
> > -                     req128_c = 1;
> > +                     req128_c = true;
> >                       swath_bytes_c = full_swath_bytes_packed_c/2;
> >               }
> >       }
> > @@ -1006,8 +1006,8 @@ static void dml_rq_dlg_get_dlg_params(struct display_mode_lib *mode_lib,
> >
> >       double min_dst_y_ttu_vblank = 0;
> >       unsigned int dlg_vblank_start = 0;
> > -     bool dual_plane = 0;
> > -     bool mode_422 = 0;
> > +     bool dual_plane = false;
> > +     bool mode_422 = false;
> >       unsigned int access_dir = 0;
> >       unsigned int vp_height_l = 0;
> >       unsigned int vp_width_l = 0;
> > @@ -1021,7 +1021,7 @@ static void dml_rq_dlg_get_dlg_params(struct display_mode_lib *mode_lib,
> >       double hratio_c = 0;
> >       double vratio_l = 0;
> >       double vratio_c = 0;
> > -     bool scl_enable = 0;
> > +     bool scl_enable = false;
> >
> >       double line_time_in_us = 0;
> >       //      double vinit_l;
> > @@ -1156,7 +1156,7 @@ static void dml_rq_dlg_get_dlg_params(struct display_mode_lib *mode_lib,
> >       // Source
> >       //                       dcc_en                   = src.dcc;
> >       dual_plane = is_dual_plane((enum source_format_class)(src->source_format));
> > -     mode_422 = 0; // TODO
> > +     mode_422 = false; // TODO
> >       access_dir = (src->source_scan == dm_vert); // vp access direction: horizontal or vertical accessed
> >       vp_height_l = src->viewport_height;
> >       vp_width_l = src->viewport_width;
> >
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the dri-devel mailing list