drm/amd/amdgpu: Cancel the hrtimer in sw_fini
authorRoy Sun <Roy.Sun@amd.com>
Fri, 11 Dec 2020 05:00:03 +0000 (13:00 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 20 May 2021 02:29:32 +0000 (22:29 -0400)
Move the process of cancelling hrtimer to sw_fini

Signed-off-by: Roy Sun <Roy.Sun@amd.com>
Reviewed-by: Emily Deng <Emily.Deng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/dce_virtual.c

index 5c11144da0513dc4a92064e6d50e3ad8bb7d95b2..33324427b555e67c4b72c89d930ae754678a0a74 100644 (file)
@@ -421,6 +421,11 @@ static int dce_virtual_sw_init(void *handle)
 static int dce_virtual_sw_fini(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
+       int i = 0;
+
+       for (i = 0; i < adev->mode_info.num_crtc; i++)
+               if (adev->mode_info.crtcs[i])
+                       hrtimer_cancel(&adev->mode_info.crtcs[i]->vblank_timer);
 
        kfree(adev->mode_info.bios_hardcoded_edid);
 
@@ -480,13 +485,6 @@ static int dce_virtual_hw_init(void *handle)
 
 static int dce_virtual_hw_fini(void *handle)
 {
-       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
-       int i = 0;
-
-       for (i = 0; i<adev->mode_info.num_crtc; i++)
-               if (adev->mode_info.crtcs[i])
-                       hrtimer_cancel(&adev->mode_info.crtcs[i]->vblank_timer);
-
        return 0;
 }