]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
drm/amdgpu: release the VM shadow in the error path as well
authorChristian König <christian.koenig@amd.com>
Fri, 2 Feb 2018 20:00:44 +0000 (21:00 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 19 Feb 2018 19:19:20 +0000 (14:19 -0500)
Without it we run into a memory leak.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index 61cf93867b8ea0b95c5e5d8625e7b8d39d6e2e86..b43098f02a40d8ccfc8fb12a735b72a8f855365e 100644 (file)
@@ -411,6 +411,7 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
 
                        r = amdgpu_vm_clear_bo(adev, vm, pt, level, ats);
                        if (r) {
+                               amdgpu_bo_unref(&pt->shadow);
                                amdgpu_bo_unref(&pt);
                                return r;
                        }
@@ -418,6 +419,7 @@ static int amdgpu_vm_alloc_levels(struct amdgpu_device *adev,
                        if (vm->use_cpu_for_update) {
                                r = amdgpu_bo_kmap(pt, NULL);
                                if (r) {
+                                       amdgpu_bo_unref(&pt->shadow);
                                        amdgpu_bo_unref(&pt);
                                        return r;
                                }