<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<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="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Wenhui Sheng <Wenhui.Sheng@amd.com><br>
<b>Sent:</b> Thursday, June 18, 2020 3:53 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Sheng, Wenhui <Wenhui.Sheng@amd.com><br>
<b>Subject:</b> [PATCH 2/2] drm/amdgpu: add fw release for sdma v5_0</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">sdma v5_0 fw isn't released when module exit<br>
<br>
Signed-off-by: Wenhui Sheng <Wenhui.Sheng@amd.com><br>
---<br>
 drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 6 +++++-<br>
 1 file changed, 5 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c<br>
index 58d2a80af450..6751ad69ed90 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c<br>
@@ -1299,8 +1299,12 @@ static int sdma_v5_0_sw_fini(void *handle)<br>
         struct amdgpu_device *adev = (struct amdgpu_device *)handle;<br>
         int i;<br>
 <br>
-       for (i = 0; i < adev->sdma.num_instances; i++)<br>
+       for (i = 0; i < adev->sdma.num_instances; i++) {<br>
+               if (adev->sdma.instance[i].fw != NULL)<br>
+                       release_firmware(adev->sdma.instance[i].fw);</div>
<div class="PlainText"><span style="font-family: calibri, arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);">[kevin]:</span><br>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0)">
the kernel api "release_firmware()" will check argument (is NULL pointer).</div>
<div style="margin: 0px; font-size: 12pt; font-family: Calibri, Arial, Helvetica, sans-serif; color: rgb(0, 0, 0)">
i think the patch don't need to double check it.</div>
+<br>
                 amdgpu_ring_fini(&adev->sdma.instance[i].ring);<br>
+       }<br>
 <br>
         return 0;<br>
 }<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%7CKevin1.Wang%40amd.com%7Cd0b8b72e0be443a7343d08d8135cb093%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637280636699912801&amp;sdata=HrKVAmRO0HKFZBRG6oWq3thNlGBd0T9bMramDU1ijys%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%7CKevin1.Wang%40amd.com%7Cd0b8b72e0be443a7343d08d8135cb093%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637280636699912801&amp;sdata=HrKVAmRO0HKFZBRG6oWq3thNlGBd0T9bMramDU1ijys%3D&amp;reserved=0</a><br>
</div>
</span></font></div>
</div>
</body>
</html>