diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2018-07-19 11:19:21 +0300 |
---|---|---|
committer | Zhenyu Wang <zhenyuw@linux.intel.com> | 2018-08-07 05:42:54 +0300 |
commit | 13bdff337e4ea467a547df771a825dd9b4ed6dd9 (patch) | |
tree | d0ae93d649af304b4fd79ed23e27dd0d591d1ed7 | |
parent | 3237c0dbe21f8d2ca2feaa3891aff3619873cd30 (diff) | |
download | linux-13bdff337e4ea467a547df771a825dd9b4ed6dd9.tar.xz |
drm/i915/kvmgt: fix an error code in gvt_dma_map_page()
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@oracle.com>
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
-rw-r--r-- | drivers/gpu/drm/i915/gvt/kvmgt.c | 6 |
1 files changed, 3 insertions, 3 deletions
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, |