Merge tag 'gvt-fixes-2017-03-08' of https://github.com/01org/gvt-linux into drm-intel...
[sfrench/cifs-2.6.git] / drivers / gpu / drm / i915 / gvt / kvmgt.c
index f07cb8ba751f90c425f8e185541272f1c44781f4..84d801638edece195bad5b659c5d739c1afcf0fc 100644 (file)
@@ -96,10 +96,10 @@ static int gvt_dma_map_iova(struct intel_vgpu *vgpu, kvm_pfn_t pfn,
        struct device *dev = &vgpu->gvt->dev_priv->drm.pdev->dev;
        dma_addr_t daddr;
 
-       page = pfn_to_page(pfn);
-       if (is_error_page(page))
+       if (unlikely(!pfn_valid(pfn)))
                return -EFAULT;
 
+       page = pfn_to_page(pfn);
        daddr = dma_map_page(dev, page, 0, PAGE_SIZE,
                        PCI_DMA_BIDIRECTIONAL);
        if (dma_mapping_error(dev, daddr))