drm/amdgpu: add missing unreserve on error
Subsystems (4)
PATCH 1/2 drm/amdgpu: add missing unreserve on error
The amdgpu_bo_unreserve() has to be done on the error path as well.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +1 -2
@@ -624,11 +624,10 @@ kfd_mem_attach_userptr(struct amdgpu_device *adev, struct kgd_mem *mem,0 , 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);
Signature · 1 line
2.30.2
PATCH 2/2 drm/amdgpu: Fix an error code in kfd_mem_attach_dmabuf()
If amdgpu_gem_prime_export() fails, then this code accidentally returns zero/success instead of a negative error code.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +3 -1
@@ -639,14 +639,16 @@ kfd_mem_attach_dmabuf(struct amdgpu_device *adev, struct kgd_mem *mem, struct amdgpu_bo **bo) {struct drm_gem_object *gobj; +int ret;if (!mem->dmabuf) { mem->dmabuf =amdgpu_gem_prime_export (&mem->bo->tbo.base, mem->alloc_flags &KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE ?DRM_RDWR :0 );if (IS_ERR (mem->dmabuf)) { + ret =PTR_ERR (mem->dmabuf); mem->dmabuf =NULL ; -return PTR_ERR (mem->dmabuf); +return ret; } }
Signature · 6 lines
2.30.2 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] drm/amdgpu: Fix an error code in kfd_mem_attach_dmabuf()
Am 2021-05-25 um 8:47 a.m. schrieb Dan Carpenter:
Quoted 5 lines
If
amdgpu_gem_prime_export()fails, then this code accidentally returns zero/success instead of a negative error code.Fixes 190f2d7696c8 ("drm/amdgpu: Add DMA mapping of GTT BOs")Signed-off-by Dan Carpenter <[email protected]>
Thank you for catching these. The series is
I am applying the patches to amd-staging-drm-next.
Quoted 16 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +1
-0@@ -639,14 +639,16 @@ kfd_mem_attach_dmabuf(struct amdgpu_device *adev, struct kgd_mem *mem, struct amdgpu_bo **bo) {struct drm_gem_object *gobj; +int ret;if (!mem->dmabuf) { mem->dmabuf = amdgpu_gem_prime_export(&mem->bo->tbo.base,
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c kfd_mem_attach_dmabuf(struct amdgpu_device *adev, struct kgd_mem *mem, · line 654
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +2
-1mem->alloc_flags &KFD_IOC_ALLOC_MEM_FLAGS_WRITABLE ? DRM_RDWR : 0);if (IS_ERR (mem->dmabuf)) { + ret =PTR_ERR (mem->dmabuf); mem->dmabuf =NULL ; -return PTR_ERR (mem->dmabuf); +return ret; } }
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx