Commit ea3f5d26 authored by Mika Kuoppala's avatar Mika Kuoppala Committed by Daniel Vetter

drm/i915/gtt: Don't leak scratch page on mapping error

Free the scratch page if dma mapping fails.
Signed-off-by: default avatarMika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 66c826a1
......@@ -2143,8 +2143,10 @@ static int setup_scratch_page(struct drm_device *dev)
#ifdef CONFIG_INTEL_IOMMU
dma_addr = pci_map_page(dev->pdev, page, 0, PAGE_SIZE,
PCI_DMA_BIDIRECTIONAL);
if (pci_dma_mapping_error(dev->pdev, dma_addr))
if (pci_dma_mapping_error(dev->pdev, dma_addr)) {
__free_page(page);
return -EINVAL;
}
#else
dma_addr = page_to_phys(page);
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment