drm/i915/gtt: Don't leak scratch page on mapping error
Free the scratch page if dma mapping fails. Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
66c826a175
commit
ea3f5d261f
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user