Re: [PATCH] [v2] amdgpu: fix gcc-4.8 build warnings

From: Arnd Bergmann
Date: Wed Apr 29 2020 - 16:16:32 EST


On Wed, Apr 29, 2020 at 3:42 PM Kazlauskas, Nicholas
<nicholas.kazlauskas@xxxxxxx> wrote:
>
> On 2020-04-29 5:20 a.m., Arnd Bergmann wrote:
> > Older compilers warn about initializers with incorrect curly
> > braces:
> >
> > drivers/gpu/drm/drm_dp_mst_topology.c: In function 'drm_dp_mst_dsc_aux_for_port':
> > drivers/gpu/drm/drm_dp_mst_topology.c:5497:9: error: missing braces around initializer [-Werror=missing-braces]
> > struct drm_dp_desc desc = { 0 };
> > ^
> >
> > Change all instances in the amd gpu driver to using the GNU empty
> > initializer extension.
>
> These should actually be memset - instead of GCC complaining, it'll be
> clang instead.

I'm not sure what you mean, clang certainly supports most GNU extensions,
and this one is used all over the kernel.

There is a good reason for using memset instead of ={}, e.g. when you want
to be sure that all padding fields get initialized before copying
stack variables
to user space, but I find it a little harder to read.

Arnd