gpu: nvgpu: unit: initialize nvgpu_mem variables

There were several places were nvgpu_mem structs were declared on the
stack and not initialized. Some fields could be used erroneously by
underlying APIs.

To allow the initialization of an array of nvgpu_mem in
test_dma_alloc_fi_delayed_enable(), the array length had to be changed
from a const to a macro.

JIRA NVGPU-1563

Change-Id: I6c23445af7d932710898df2e23a8fd892bee77b3
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1967966
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Philip Elcan
2018-12-07 10:15:26 -05:00
committed by mobile promotions
parent 6777bd5ed2
commit 8f15a2903c
4 changed files with 17 additions and 17 deletions

View File

@@ -344,7 +344,7 @@ static u64 pte_get_phys_addr(u32 *pte)
static int test_nvgpu_gmmu_map_unmap(struct unit_module *m,
struct gk20a *g, void *args)
{
struct nvgpu_mem mem;
struct nvgpu_mem mem = { };
u32 pte[2];
int result;
struct nvgpu_os_posix *p = nvgpu_os_posix_from_gk20a(g);
@@ -443,7 +443,7 @@ static int test_nvgpu_gmmu_map_unmap(struct unit_module *m,
static int test_nvgpu_gmmu_set_pte(struct unit_module *m,
struct gk20a *g, void *args)
{
struct nvgpu_mem mem;
struct nvgpu_mem mem = { };
u32 pte[2];
int result;
struct nvgpu_os_posix *p = nvgpu_os_posix_from_gk20a(g);
@@ -582,7 +582,7 @@ static void gmmu_unmap_advanced(struct vm_gk20a *vm, struct nvgpu_mem *mem,
static int test_nvgpu_gmmu_map_unmap_adv(struct unit_module *m,
struct gk20a *g, void *args)
{
struct nvgpu_mem mem;
struct nvgpu_mem mem = { };
u64 vaddr;
struct test_parameters *params = (struct test_parameters *) args;
@@ -609,7 +609,7 @@ static int test_nvgpu_gmmu_map_unmap_adv(struct unit_module *m,
static int test_nvgpu_gmmu_map_unmap_batched(struct unit_module *m,
struct gk20a *g, void *args)
{
struct nvgpu_mem mem, mem2;
struct nvgpu_mem mem = { }, mem2 = { };
u64 vaddr, vaddr2;
struct vm_gk20a_mapping_batch batch;