Re: [PATCH] drm/amdgpu/gmc: fix compiler errors [-Werror,-Wmissing-braces]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>


From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> on behalf of S, Shirish <Shirish.S@xxxxxxx>
Sent: Thursday, December 20, 2018 9:01:33 AM
To: Li, Sun peng (Leo); Wentland, Harry; Deucher, Alexander; Koenig, Christian
Cc: amd-gfx@xxxxxxxxxxxxxxxxxxxxx; S, Shirish
Subject: [PATCH] drm/amdgpu/gmc: fix compiler errors [-Werror,-Wmissing-braces]
 
Initializing structures with { } is known to be problematic since
it doesn't necessararily initializes all bytes, in case of padding,
causing random failures when structures are memcmp().

This patch fixes the structure initialisation compiler error by memsetting
the entire structure elements instead of only the first one.

Signed-off-by: Shirish S <shirish.s@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
index 1ad7e6b..3444067 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
@@ -1471,8 +1471,9 @@ static int gmc_v8_0_process_interrupt(struct amdgpu_device *adev,
                 gmc_v8_0_set_fault_enable_default(adev, false);
 
         if (printk_ratelimit()) {
-               struct amdgpu_task_info task_info = { 0 };
+               struct amdgpu_task_info task_info;
 
+               memset(&task_info, 0, sizeof(struct amdgpu_task_info));
                 amdgpu_vm_get_task_info(adev, entry->pasid, &task_info);
 
                 dev_err(adev->dev, "GPU fault detected: %d 0x%08x for process %s pid %d thread %s pid %d\n",
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index bacdaef..2bfddce 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -320,8 +320,9 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev,
         }
 
         if (printk_ratelimit()) {
-               struct amdgpu_task_info task_info = { 0 };
+               struct amdgpu_task_info task_info;
 
+               memset(&task_info, 0, sizeof(amdgpu_task_info));
                 amdgpu_vm_get_task_info(adev, entry->pasid, &task_info);
 
                 dev_err(adev->dev,
--
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux