diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-11-15 14:42:34 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-11-16 15:39:01 -0500 |
commit | 201fb02c244759fe4ade7c347a3b5f26b698be05 (patch) | |
tree | 970dcc9bff184b470f49f7021106ed9e0f9d5738 | |
parent | 1fc7ded060c7e4b359db43be763f7dc0af7276cb (diff) |
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 <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1598933
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/dma.c | 6 |
1 files changed, 3 insertions, 3 deletions
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, | |||
231 | 231 | ||
232 | nvgpu_dma_flags_to_attrs(&dma_attrs, flags); | 232 | nvgpu_dma_flags_to_attrs(&dma_attrs, flags); |
233 | 233 | ||
234 | alloc_ret = dma_alloc_attrs(d, size, &iova, GFP_KERNEL, | 234 | alloc_ret = dma_alloc_attrs(d, size, &iova, |
235 | __DMA_ATTR(dma_attrs)); | 235 | GFP_KERNEL|__GFP_ZERO, |
236 | __DMA_ATTR(dma_attrs)); | ||
236 | if (!alloc_ret) | 237 | if (!alloc_ret) |
237 | return -ENOMEM; | 238 | return -ENOMEM; |
238 | 239 | ||
@@ -245,7 +246,6 @@ int nvgpu_dma_alloc_flags_sys(struct gk20a *g, unsigned long flags, | |||
245 | mem->cpu_va = alloc_ret; | 246 | mem->cpu_va = alloc_ret; |
246 | err = nvgpu_get_sgtable_attrs(g, &mem->priv.sgt, mem->cpu_va, | 247 | err = nvgpu_get_sgtable_attrs(g, &mem->priv.sgt, mem->cpu_va, |
247 | iova, size, flags); | 248 | iova, size, flags); |
248 | memset(mem->cpu_va, 0, size); | ||
249 | } | 249 | } |
250 | if (err) | 250 | if (err) |
251 | goto fail_free; | 251 | goto fail_free; |