diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2019-01-22 23:07:11 -0500 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2019-01-23 10:20:43 -0500 |
commit | 9a71ac7e15a723e90fc40388b4b92eefaabf747c (patch) | |
tree | 2c867dd964de4b13f97ea137cf57a5d66e070cca /drivers | |
parent | 33e5ee780e37bcf494013e2497580b00b7676507 (diff) |
vfio-pci/nvlink2: Fix ancient gcc warnings
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
Fixes: 7f92891778df ("vfio_pci: Add NVIDIA GV100GL [Tesla V100 SXM2] subdriver")
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/vfio/pci/vfio_pci_nvlink2.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/vfio/pci/vfio_pci_nvlink2.c b/drivers/vfio/pci/vfio_pci_nvlink2.c index fd6afbd14e77..32f695ffe128 100644 --- a/drivers/vfio/pci/vfio_pci_nvlink2.c +++ b/drivers/vfio/pci/vfio_pci_nvlink2.c | |||
@@ -174,11 +174,11 @@ static int vfio_pci_nvgpu_add_capability(struct vfio_pci_device *vdev, | |||
174 | struct vfio_pci_region *region, struct vfio_info_cap *caps) | 174 | struct vfio_pci_region *region, struct vfio_info_cap *caps) |
175 | { | 175 | { |
176 | struct vfio_pci_nvgpu_data *data = region->data; | 176 | struct vfio_pci_nvgpu_data *data = region->data; |
177 | struct vfio_region_info_cap_nvlink2_ssatgt cap = { 0 }; | 177 | struct vfio_region_info_cap_nvlink2_ssatgt cap = { |
178 | 178 | .header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT, | |
179 | cap.header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT; | 179 | .header.version = 1, |
180 | cap.header.version = 1; | 180 | .tgt = data->gpu_tgt |
181 | cap.tgt = data->gpu_tgt; | 181 | }; |
182 | 182 | ||
183 | return vfio_info_add_capability(caps, &cap.header, sizeof(cap)); | 183 | return vfio_info_add_capability(caps, &cap.header, sizeof(cap)); |
184 | } | 184 | } |
@@ -361,18 +361,18 @@ static int vfio_pci_npu2_add_capability(struct vfio_pci_device *vdev, | |||
361 | struct vfio_pci_region *region, struct vfio_info_cap *caps) | 361 | struct vfio_pci_region *region, struct vfio_info_cap *caps) |
362 | { | 362 | { |
363 | struct vfio_pci_npu2_data *data = region->data; | 363 | struct vfio_pci_npu2_data *data = region->data; |
364 | struct vfio_region_info_cap_nvlink2_ssatgt captgt = { 0 }; | 364 | struct vfio_region_info_cap_nvlink2_ssatgt captgt = { |
365 | struct vfio_region_info_cap_nvlink2_lnkspd capspd = { 0 }; | 365 | .header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT, |
366 | .header.version = 1, | ||
367 | .tgt = data->gpu_tgt | ||
368 | }; | ||
369 | struct vfio_region_info_cap_nvlink2_lnkspd capspd = { | ||
370 | .header.id = VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD, | ||
371 | .header.version = 1, | ||
372 | .link_speed = data->link_speed | ||
373 | }; | ||
366 | int ret; | 374 | int ret; |
367 | 375 | ||
368 | captgt.header.id = VFIO_REGION_INFO_CAP_NVLINK2_SSATGT; | ||
369 | captgt.header.version = 1; | ||
370 | captgt.tgt = data->gpu_tgt; | ||
371 | |||
372 | capspd.header.id = VFIO_REGION_INFO_CAP_NVLINK2_LNKSPD; | ||
373 | capspd.header.version = 1; | ||
374 | capspd.link_speed = data->link_speed; | ||
375 | |||
376 | ret = vfio_info_add_capability(caps, &captgt.header, sizeof(captgt)); | 376 | ret = vfio_info_add_capability(caps, &captgt.header, sizeof(captgt)); |
377 | if (ret) | 377 | if (ret) |
378 | return ret; | 378 | return ret; |