[Intel-gfx] [PATCH] drm/i915/kvmgt: fix an error code in gvt_dma_map_page()

Zhenyu Wang zhenyuw at linux.intel.com
Tue Aug 7 02:40:39 UTC 2018


On 2018.07.19 11:19:21 +0300, Dan Carpenter wrote:
> The dma_mapping_error() returns true on error but we want to return
> -ENOMEM here.
> 
> Fixes: 79e542f5af79 ("drm/i915/kvmgt: Support setting dma map for huge pages")
> Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
>

Applied, thanks!

> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index 4d2f53ae9f0f..32ec5748f176 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -187,14 +187,14 @@ static int gvt_dma_map_page(struct intel_vgpu *vgpu, unsigned long gfn,
>  
>  	/* Setup DMA mapping. */
>  	*dma_addr = dma_map_page(dev, page, 0, size, PCI_DMA_BIDIRECTIONAL);
> -	ret = dma_mapping_error(dev, *dma_addr);
> -	if (ret) {
> +	if (dma_mapping_error(dev, *dma_addr)) {
>  		gvt_vgpu_err("DMA mapping failed for pfn 0x%lx, ret %d\n",
>  			     page_to_pfn(page), ret);
>  		gvt_unpin_guest_page(vgpu, gfn, size);
> +		return -ENOMEM;
>  	}
>  
> -	return ret;
> +	return 0;
>  }
>  
>  static void gvt_dma_unmap_page(struct intel_vgpu *vgpu, unsigned long gfn,
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gfx/attachments/20180807/87439e9e/attachment.sig>


More information about the Intel-gfx mailing list