From: Michel Thierry Date: Tue, 24 Mar 2015 17:06:33 +0000 (+0000) Subject: drm/i915: Fix i915_dma_map_single positive error code X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1266cdb1c236eabd49cbf1e45f401159fb4c21d1;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git drm/i915: Fix i915_dma_map_single positive error code i915_dma_map_single relies on dma_mapping_error, which returns positive error codes. Found by static checker. Introduced by commit 678d96fbb3b5995a2fdff2bca5e1ab4a40b7e968 ("drm/i915: Track GEN6 page table usage"). v2: Return negative error code and renamed commit title. (Dan) v3: Missing reported-by tag (Daniel) Reported-by: Dan Carpenter Cc: Dan Carpenter Cc: Mika Kuoppala Cc: Daniel Vetter Signed-off-by: Michel Thierry Reviewed-by: Mika Kuoppala Signed-off-by: Daniel Vetter --- diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c index 9903bb0097a6..9c155d1f852f 100644 --- a/drivers/gpu/drm/i915/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c @@ -311,7 +311,10 @@ static inline int i915_dma_map_page_single(struct page *page, struct device *device = &dev->pdev->dev; *daddr = dma_map_page(device, page, 0, 4096, PCI_DMA_BIDIRECTIONAL); - return dma_mapping_error(device, *daddr); + if (dma_mapping_error(device, *daddr)) + return -ENOMEM; + + return 0; } static void unmap_and_free_pt(struct i915_page_table_entry *pt,