From: Felix Kuehling <Felix.Kuehling@amd.com>
Date: Fri, 25 Aug 2017 20:15:04 -0400
Subject: drm/amdgpu: Fix error handling in amdgpu_vm_init
Git-commit: ca290da8f6345c8e8e180256fbe092c751fa9654
Patch-mainline: v4.15-rc1
References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166
Make sure vm->root.bo is not left reserved if amdgpu_bo_kmap fails.
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -2615,9 +2615,9 @@ int amdgpu_vm_init(struct amdgpu_device
goto error_free_root;
r = amdgpu_bo_kmap(vm->root.base.bo, NULL);
+ amdgpu_bo_unreserve(vm->root.base.bo);
if (r)
goto error_free_root;
- amdgpu_bo_unreserve(vm->root.base.bo);
}
return 0;