drm/amdgpu/gmc: fix compiler errors [-Werror,-Wmissing-braces] (V2)
authorShirish S <shirish.s@amd.com>
Thu, 20 Dec 2018 10:34:35 +0000 (16:04 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 14 Jan 2019 20:04:46 +0000 (15:04 -0500)
Initializing structures with { } is known to be problematic since
it doesn't necessararily initialize all bytes, in case of padding,
causing random failures when structures are memcmp().

This patch fixes the structure initialisation related compiler
error by memset().

V2: rectified missing piece in coding

Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c

index 1ad7e6b8ed1dcf3f8795eab178f672938e82d050..34440672f938455a473e9dc4c9c5716236568aa3 100644 (file)
@@ -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",
index bacdaef77b6c1ad0d3e12943e2bf53fefcea74b9..521ac8954652d792d2e78bbdbaad3e03be5a8e56 100644 (file)
@@ -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(struct amdgpu_task_info));
                amdgpu_vm_get_task_info(adev, entry->pasid, &task_info);
 
                dev_err(adev->dev,