[Intel-gfx] [PATCH v2] drm/i915: Fix i915_dma_map_single positive error code
Daniel Vetter
daniel at ffwll.ch
Tue Mar 24 09:54:09 PDT 2015
On Tue, Mar 24, 2015 at 04:44:38PM +0000, Michel Thierry wrote:
> 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 rename commit title. (Dan)
>
> Cc: Dan Carpenter <dan.carpenter at oracle.com>
> Cc: Mika Kuoppala <mika.kuoppala at intel.com>
Still missing the reported-by. Giving credit where it's due is important,
especially when they work for other companies than Intel.
-Daniel
> Signed-off-by: Michel Thierry <michel.thierry at intel.com>
> ---
> drivers/gpu/drm/i915/i915_gem_gtt.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 645c363..6bb31c8 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,
> --
> 2.1.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
More information about the Intel-gfx
mailing list