<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Reviewed-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of S, Shirish <Shirish.S@amd.com><br>
<b>Sent:</b> Thursday, December 20, 2018 9:01:33 AM<br>
<b>To:</b> Li, Sun peng (Leo); Wentland, Harry; Deucher, Alexander; Koenig, Christian<br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org; S, Shirish<br>
<b>Subject:</b> [PATCH] drm/amdgpu/gmc: fix compiler errors [-Werror,-Wmissing-braces]</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Initializing structures with { } is known to be problematic since<br>
it doesn't necessararily initializes all bytes, in case of padding,<br>
causing random failures when structures are memcmp().<br>
<br>
This patch fixes the structure initialisation compiler error by memsetting<br>
the entire structure elements instead of only the first one.<br>
<br>
Signed-off-by: Shirish S <shirish.s@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 3 ++-<br>
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 ++-<br>
2 files changed, 4 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c<br>
index 1ad7e6b..3444067 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c<br>
@@ -1471,8 +1471,9 @@ static int gmc_v8_0_process_interrupt(struct amdgpu_device *adev,<br>
gmc_v8_0_set_fault_enable_default(adev, false);<br>
<br>
if (printk_ratelimit()) {<br>
- struct amdgpu_task_info task_info = { 0 };<br>
+ struct amdgpu_task_info task_info;<br>
<br>
+ memset(&task_info, 0, sizeof(struct amdgpu_task_info));<br>
amdgpu_vm_get_task_info(adev, entry->pasid, &task_info);<br>
<br>
dev_err(adev->dev, "GPU fault detected: %d 0x%08x for process %s pid %d thread %s pid %d\n",<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c<br>
index bacdaef..2bfddce 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c<br>
@@ -320,8 +320,9 @@ static int gmc_v9_0_process_interrupt(struct amdgpu_device *adev,<br>
}<br>
<br>
if (printk_ratelimit()) {<br>
- struct amdgpu_task_info task_info = { 0 };<br>
+ struct amdgpu_task_info task_info;<br>
<br>
+ memset(&task_info, 0, sizeof(amdgpu_task_info));<br>
amdgpu_vm_get_task_info(adev, entry->pasid, &task_info);<br>
<br>
dev_err(adev->dev,<br>
-- <br>
2.7.4<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>