<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<p style="font-family:Arial;font-size:10pt;color:#0078D7;margin:15pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255); text-align: left;" dir="auto">
I just got hit by this bug.</div>
<div style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255); text-align: left;" dir="auto">
<br>
</div>
<div id="ms-outlook-mobile-signature" dir="auto" style="text-align: left;">
<div dir="auto" style="text-align: left;"><span style="font-family: -apple-system, HelveticaNeue; font-size: 14.6667px; text-align: start; display: inline !important;">Reviewed-by: Nirmoy Das <nirmoy.das</span><a href="mailto:Le.Ma@amd.com" style="font-family: -apple-system, HelveticaNeue; font-size: 14.6667px; text-align: start;">@amd.com</a><span style="font-family: -apple-system, HelveticaNeue; font-size: 14.6667px; text-align: start; display: inline !important;">></span><br>
</div>
<div id="ms-outlook-mobile-signature" dir="auto" style="text-align: left;"><br>
</div>
Thanks, </div>
<div id="ms-outlook-mobile-signature" dir="auto" style="text-align: left;">Nirmoy </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 Hawking Zhang <Hawking.Zhang@amd.com><br>
<b>Sent:</b> Thursday, January 9, 2020 12:42:13 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Zhang, Hawking <Hawking.Zhang@amd.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu: check sdma ras funcs pointer before accessing</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">sdma ras funcs are not supported by ASIC prior<br>
to vega20<br>
<br>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 8 ++++++--<br>
 1 file changed, 6 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
index f4107f9b75f3..c4b4caaf56fe 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c<br>
@@ -1810,7 +1810,10 @@ static int sdma_v4_0_late_init(void *handle)<br>
                         RREG32_SDMA(i, mmSDMA0_EDC_COUNTER);<br>
         }<br>
 <br>
-       return adev->sdma.funcs->ras_late_init(adev, &ih_info);<br>
+       if (adev->sdma.funcs && adev->sdma.funcs->ras_late_init)<br>
+               return adev->sdma.funcs->ras_late_init(adev, &ih_info);<br>
+       else<br>
+               return 0;<br>
 }<br>
 <br>
 static int sdma_v4_0_sw_init(void *handle)<br>
@@ -1882,7 +1885,8 @@ static int sdma_v4_0_sw_fini(void *handle)<br>
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
         int i;<br>
 <br>
-       adev->sdma.funcs->ras_fini(adev);<br>
+       if (adev->sdma.funcs && adev->sdma.funcs->ras_fini)<br>
+               adev->sdma.funcs->ras_fini(adev);<br>
 <br>
         for (i = 0; i < adev->sdma.num_instances; i++) {<br>
                 amdgpu_ring_fini(&adev->sdma.instance[i].ring);<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cnirmoy.das%40amd.com%7Cf443faf2f98f4135d8a408d794f8fdd0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637141669492821558&amp;sdata=tKUUR%2BJwv8V19Q0zr0oQg48tG9j7goCQ7L6EzNuv6JI%3D&amp;reserved=0">https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cnirmoy.das%40amd.com%7Cf443faf2f98f4135d8a408d794f8fdd0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637141669492821558&amp;sdata=tKUUR%2BJwv8V19Q0zr0oQg48tG9j7goCQ7L6EzNuv6JI%3D&amp;reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>