From 201fb02c244759fe4ade7c347a3b5f26b698be05 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 15 Nov 2017 11:42:34 -0800 Subject: gpu: nvgpu: Always allocate zeroed DMA mem Always allocate explicitly zeroed DMA memory and remove the unnecessary memset() from the alloc path for memory with a kernel mapping. JIRA NVGPU-418 Change-Id: I5a3df6e6969e2586df41b72325d1bff1e40206e6 Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1598933 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/dma.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/common/linux/dma.c b/drivers/gpu/nvgpu/common/linux/dma.c index 22f2cefb..d0b6c8a8 100644 --- a/drivers/gpu/nvgpu/common/linux/dma.c +++ b/drivers/gpu/nvgpu/common/linux/dma.c @@ -231,8 +231,9 @@ int nvgpu_dma_alloc_flags_sys(struct gk20a *g, unsigned long flags, nvgpu_dma_flags_to_attrs(&dma_attrs, flags); - alloc_ret = dma_alloc_attrs(d, size, &iova, GFP_KERNEL, - __DMA_ATTR(dma_attrs)); + alloc_ret = dma_alloc_attrs(d, size, &iova, + GFP_KERNEL|__GFP_ZERO, + __DMA_ATTR(dma_attrs)); if (!alloc_ret) return -ENOMEM; @@ -245,7 +246,6 @@ int nvgpu_dma_alloc_flags_sys(struct gk20a *g, unsigned long flags, mem->cpu_va = alloc_ret; err = nvgpu_get_sgtable_attrs(g, &mem->priv.sgt, mem->cpu_va, iova, size, flags); - memset(mem->cpu_va, 0, size); } if (err) goto fail_free; -- cgit v1.2.2