drm/amdgpu: add fw release for sdma v5_0
authorWenhui Sheng <Wenhui.Sheng@amd.com>
Thu, 18 Jun 2020 07:37:04 +0000 (15:37 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 30 Jun 2020 19:36:28 +0000 (15:36 -0400)
commit edfaf6fa73f15568d4337f208b2333f647c35810 upstream.

sdma fw isn't released when module exit

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Wenhui Sheng <Wenhui.Sheng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c

index d2840c2f62865c23229d599fecfa530be2be7ce7..1dc57079933ce64cd6f9b172812fc29468559041 100644 (file)
@@ -1261,8 +1261,12 @@ static int sdma_v5_0_sw_fini(void *handle)
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
        int i;
 
-       for (i = 0; i < adev->sdma.num_instances; i++)
+       for (i = 0; i < adev->sdma.num_instances; i++) {
+               if (adev->sdma.instance[i].fw != NULL)
+                       release_firmware(adev->sdma.instance[i].fw);
+
                amdgpu_ring_fini(&adev->sdma.instance[i].ring);
+       }
 
        return 0;
 }