[PATCH] drm/msm/mdp5: Fix compilation warnings

Chris Wilson chris at chris-wilson.co.uk
Wed Jul 19 12:13:50 UTC 2017


Quoting Viresh Kumar (2017-06-29 10:19:59)
> Following compilation warnings were observed for these files:
> 
>   CC [M]  drivers/gpu/drm/msm/mdp/mdp5/mdp5_mdss.o
> drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c: In function 'blend_setup':
> drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c:223:7: warning: missing braces around initializer [-Wmissing-braces]
>   enum mdp5_pipe stage[STAGE_MAX + 1][MAX_PIPE_STAGE] = { SSPP_NONE };
>        ^
> drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c:223:7: warning: (near initialization for 'stage[0]') [-Wmissing-braces]
> drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c:224:7: warning: missing braces around initializer [-Wmissing-braces]
>   enum mdp5_pipe r_stage[STAGE_MAX + 1][MAX_PIPE_STAGE] = { SSPP_NONE };
>        ^
> drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c:224:7: warning: (near initialization for 'r_stage[0]') [-Wmissing-braces]
> 
> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c: In function 'mdp5_plane_mode_set':
> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:892:9: warning: missing braces around initializer [-Wmissing-braces]
>   struct phase_step step = { 0 };
>          ^
> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:892:9: warning: (near initialization for 'step.x') [-Wmissing-braces]
> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:893:9: warning: missing braces around initializer [-Wmissing-braces]
>   struct pixel_ext pe = { 0 };
>          ^
> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:893:9: warning: (near initialization for 'pe.left') [-Wmissing-braces]
> 
> This happens because in the first case we were initializing a two
> dimensional array with {0} and in the second case we were initializing a
> struct containing two arrays with {0}.
> 
> Fix them by adding another pair of {}.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar at linaro.org>
> ---
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c  | 4 ++--
>  drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
> index 9217e0d6e93e..b2c68072a805 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
> @@ -220,8 +220,8 @@ static void blend_setup(struct drm_crtc *crtc)
>         struct mdp5_ctl *ctl = mdp5_cstate->ctl;
>         uint32_t blend_op, fg_alpha, bg_alpha, ctl_blend_flags = 0;
>         unsigned long flags;
> -       enum mdp5_pipe stage[STAGE_MAX + 1][MAX_PIPE_STAGE] = { SSPP_NONE };
> -       enum mdp5_pipe r_stage[STAGE_MAX + 1][MAX_PIPE_STAGE] = { SSPP_NONE };
> +       enum mdp5_pipe stage[STAGE_MAX + 1][MAX_PIPE_STAGE] = { { SSPP_NONE } };
> +       enum mdp5_pipe r_stage[STAGE_MAX + 1][MAX_PIPE_STAGE] = { { SSPP_NONE } };
>         int i, plane_cnt = 0;
>         bool bg_alpha_enabled = false;
>         u32 mixer_op_mode = 0;
> diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> index 7d3741215387..0ee9bd0041cd 100644
> --- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> +++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
> @@ -889,8 +889,8 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
>         struct mdp5_hw_pipe *right_hwpipe;
>         const struct mdp_format *format;
>         uint32_t nplanes, config = 0;
> -       struct phase_step step = { 0 };
> -       struct pixel_ext pe = { 0 };
> +       struct phase_step step = { { 0 } };
> +       struct pixel_ext pe = { { 0 } };
>         uint32_t hdecm = 0, vdecm = 0;
>         uint32_t pix_format;
>         unsigned int rotation;

Or just use {} to initialise to zero whatever the struct layout?
-Chris


More information about the dri-devel mailing list