From: Christian König Date: Fri, 2 Feb 2018 20:00:44 +0000 (+0100) Subject: drm/amdgpu: release the VM shadow in the error path as well X-Git-Tag: v4.17-rc1~27^2~26^2~110 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e5197a4c3dbff322efe1f70e23453318554d1598;p=uclinux-h8%2Flinux.git drm/amdgpu: release the VM shadow in the error path as well Without it we run into a memory leak. Signed-off-by: Christian König Reviewed-by: Chunming Zhou Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 61cf93867b8e..b43098f02a40 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -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; }