drm/amdgpu/discovery: Need to free discovery memory
authorEmily Deng <Emily.Deng@amd.com>
Mon, 4 Nov 2019 04:45:09 +0000 (12:45 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 6 Nov 2019 21:27:47 +0000 (16:27 -0500)
When unloading driver, need to free discovery memory.

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c

index d5d9161692264aabf02359397623d0d79520e7ba..61d9b7774d42ef87ab26ee2a8d6916d19cea355e 100644 (file)
@@ -1906,9 +1906,6 @@ void amdgpu_ttm_late_init(struct amdgpu_device *adev)
        void *stolen_vga_buf;
        /* return the VGA stolen memory (if any) back to VRAM */
        amdgpu_bo_free_kernel(&adev->stolen_vga_memory, NULL, &stolen_vga_buf);
-
-       /* return the IP Discovery TMR memory back to VRAM */
-       amdgpu_bo_free_kernel(&adev->discovery_memory, NULL, NULL);
 }
 
 /**
@@ -1921,7 +1918,10 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)
 
        amdgpu_ttm_debugfs_fini(adev);
        amdgpu_ttm_training_reserve_vram_fini(adev);
+       /* return the IP Discovery TMR memory back to VRAM */
+       amdgpu_bo_free_kernel(&adev->discovery_memory, NULL, NULL);
        amdgpu_ttm_fw_reserve_vram_fini(adev);
+
        if (adev->mman.aper_base_kaddr)
                iounmap(adev->mman.aper_base_kaddr);
        adev->mman.aper_base_kaddr = NULL;