Re: [PATCH 2/2] drm/amdgpu: Fix an error code in kfd_mem_attach_dmabuf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 2021-05-25 um 8:47 a.m. schrieb Dan Carpenter:
> 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 <dan.carpenter@xxxxxxxxxx>

Thank you for catching these. The series is

Reviewed-by: Felix Kuehling <Felix.Kuehling@xxxxxxx>

I am applying the patches to amd-staging-drm-next.


> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> index 68109908a869..9b7a3f849a16 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
> @@ -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;
>  		}
>  	}
>  



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux