linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org
Subject: Re: [PATCH kernel] vfio-pci/nvlink2: Fix ancient gcc warnings
Date: Wed, 23 Jan 2019 13:06:08 -0700	[thread overview]
Message-ID: <20190123130608.1b2540c9@w520.home> (raw)
In-Reply-To: <20190123040711.21759-1-aik@ozlabs.ru>

On Wed, 23 Jan 2019 15:07:11 +1100
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:

> Using the {0} construct as a generic initializer is perfectly fine in C,
> however due to a bug in old gcc there is a warning:
> 
>   + /kisskb/src/drivers/vfio/pci/vfio_pci_nvlink2.c: warning: (near
> initialization for 'cap.header') [-Wmissing-braces]:  => 181:9
> 
> Since for whatever reason we still want to compile the modern kernel
> with such an old gcc without warnings, this changes the capabilities
> initialization.
> 
> The gcc bugzilla: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Added Fixes: and Reported-by: tags.

Applied to for-linus branch for v5.0.  Thanks,

Alex

> ---
>  drivers/vfio/pci/vfio_pci_nvlink2.c | 30 ++++++++++++++---------------
>  1 file changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c
> index 054a2cf..91d945b 100644
> --- a/drivers/vfio/pci/vfio_pci_nvlink2.c
> +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c
> @@ -178,11 +178,11 @@ static int vfio_pci_nvgpu_add_capability(struct vfio_pci_device *vdev,
>  		struct vfio_pci_region *region, struct vfio_info_cap *caps)
>  {
>  	struct vfio_pci_nvgpu_data *data = region->data;
> -	struct vfio_region_info_cap_nvlink2_ssatgt cap = { 0 };
> -
> -	cap.header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT;
> -	cap.header.version = 1;
> -	cap.tgt = data->gpu_tgt;
> +	struct vfio_region_info_cap_nvlink2_ssatgt cap = {
> +		.header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT,
> +		.header.version = 1,
> +		.tgt = data->gpu_tgt
> +	};
>  
>  	return vfio_info_add_capability(caps, &cap.header, sizeof(cap));
>  }
> @@ -365,18 +365,18 @@ static int vfio_pci_npu2_add_capability(struct vfio_pci_device *vdev,
>  		struct vfio_pci_region *region, struct vfio_info_cap *caps)
>  {
>  	struct vfio_pci_npu2_data *data = region->data;
> -	struct vfio_region_info_cap_nvlink2_ssatgt captgt = { 0 };
> -	struct vfio_region_info_cap_nvlink2_lnkspd capspd = { 0 };
> +	struct vfio_region_info_cap_nvlink2_ssatgt captgt = {
> +		.header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT,
> +		.header.version = 1,
> +		.tgt = data->gpu_tgt
> +	};
> +	struct vfio_region_info_cap_nvlink2_lnkspd capspd = {
> +		.header.id = VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD,
> +		.header.version = 1,
> +		.link_speed = data->link_speed
> +	};
>  	int ret;
>  
> -	captgt.header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT;
> -	captgt.header.version = 1;
> -	captgt.tgt = data->gpu_tgt;
> -
> -	capspd.header.id = VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD;
> -	capspd.header.version = 1;
> -	capspd.link_speed = data->link_speed;
> -
>  	ret = vfio_info_add_capability(caps, &captgt.header, sizeof(captgt));
>  	if (ret)
>  		return ret;


      parent reply	other threads:[~2019-01-23 20:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23  4:07 [PATCH kernel] vfio-pci/nvlink2: Fix ancient gcc warnings Alexey Kardashevskiy
2019-01-23  4:30 ` Alex Williamson
2019-01-23  8:18   ` Geert Uytterhoeven
2019-01-23 23:08     ` Michael Ellerman
2019-01-23 20:06 ` Alex Williamson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190123130608.1b2540c9@w520.home \
    --to=alex.williamson@redhat.com \
    --cc=aik@ozlabs.ru \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).