From: Dan Carpenter Date: Tue, 25 May 2021 12:46:55 +0000 (+0300) Subject: drm/amdgpu: add missing unreserve on error X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3e06db4d62a80932395fea36e4081a4c15116bae;p=linux.git drm/amdgpu: add missing unreserve on error The amdgpu_bo_unreserve() has to be done on the error path as well. Fixes: 9e5d275319e224 ("drm/amdgpu: Move kfd_mem_attach outside reservation") Signed-off-by: Dan Carpenter Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index 2b8b895351988..71ad9baa3e3c8 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -624,11 +624,10 @@ kfd_mem_attach_userptr(struct amdgpu_device *adev, struct kgd_mem *mem, AMDGPU_GEM_CREATE_PREEMPTIBLE, ttm_bo_type_sg, mem->bo->tbo.base.resv, &gobj); + amdgpu_bo_unreserve(mem->bo); if (ret) return ret; - amdgpu_bo_unreserve(mem->bo); - *bo = gem_to_amdgpu_bo(gobj); (*bo)->parent = amdgpu_bo_ref(mem->bo);