mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
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>
This commit is contained in:
committed by
mobile promotions
parent
1fc7ded060
commit
201fb02c24
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user