Subject: Re: [PATCH net-next v4 2/5] bus: fsl-mc: add the fsl_mc_get_endpoint function

From: Russell King - ARM Linux admin <[email-masked]>
Date: Sun, 17 Nov 2019 19:42:48 +0000

On Thu, Oct 31, 2019 at 01:18:29AM +0200, Ioana Ciornei wrote:
> Using the newly added fsl_mc_get_endpoint function a fsl-mc driver can
> find its associated endpoint (another object at the other link of a MC
> firmware link).
> 
> The API will be used in the following patch in order to discover the
> connected DPMAC object of a DPNI.
> 
> Also, the fsl_mc_device_lookup function is made available to the entire
> fsl-mc bus driver and not just for the dprc driver.
> 
> Signed-off-by: Ioana Ciornei <[email-masked]>

When building this with gcc 4.9.2, I get these warnings:

drivers/bus/fsl-mc/fsl-mc-bus.c: In function 'fsl_mc_get_endpoint':
drivers/bus/fsl-mc/fsl-mc-bus.c:718:9: warning: missing braces around initializer [-Wmissing-braces]
  struct fsl_mc_obj_desc endpoint_desc = { 0 };
         ^
drivers/bus/fsl-mc/fsl-mc-bus.c:718:9: warning: (near initialization for 'endpoint_desc.type') [-Wmissing-braces]
drivers/bus/fsl-mc/fsl-mc-bus.c:719:9: warning: missing braces around initializer [-Wmissing-braces]
  struct dprc_endpoint endpoint1 = { 0 };
         ^
drivers/bus/fsl-mc/fsl-mc-bus.c:719:9: warning: (near initialization for 'endpoint1.type') [-Wmissing-braces]
drivers/bus/fsl-mc/fsl-mc-bus.c:720:9: warning: missing braces around initializer [-Wmissing-braces]
  struct dprc_endpoint endpoint2 = { 0 };
         ^
drivers/bus/fsl-mc/fsl-mc-bus.c:720:9: warning: (near initialization for 'endpoint2.type') [-Wmissing-braces]

This seems to be a legit complaint - the first member of these is a
char array, and initialising an array with an integer 0 has provoked
this and previous versions of GCC to complain.

Both GCC and Clang support the empty initialiser, despite not being
valid C99.  If you want to be C99 compliant, the alternative is to
explicitly memset() these structures.

In all these cases, the CPU has to do work to set these structures to
zero (using memset() will also get any padding too.)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up