gpu: nvgpu: fix MISRA 21.3 mm nvgpu allocator

MISRA rule 21.3 forbids from using calloc, malloc, realloc and free
identifiers for function or macro names. This patch renames nvgpu
allocator free operator to free_alloc to follow rule 21.3.

Jira NVGPU-3336

Change-Id: Ie9f48d567255a3e1dca70632fbe3d36b45023f3f
Signed-off-by: Vedashree Vidwans <vvidwans@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2111365
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:
Vedashree Vidwans
2019-05-03 09:28:21 -07:00
committed by mobile promotions
parent 2b165deba1
commit 778f6b2874
10 changed files with 25 additions and 24 deletions

View File

@@ -101,7 +101,7 @@ static int test_nvgpu_bitmap_allocator_critical(struct unit_module *m,
goto fail;
}
na->ops->free(na, addr1);
na->ops->free_alloc(na, addr1);
na->ops->free_fixed(na, SZ_4K, SZ_8K);
@@ -162,9 +162,9 @@ static int test_nvgpu_bitmap_allocator_alloc(struct unit_module *m,
}
nvgpu_posix_enable_fault_injection(kmem_fi, false, 0);
na->ops->free(na, alloc3k);
na->ops->free_alloc(na, alloc3k);
na->ops->free(na, alloc3k);
na->ops->free_alloc(na, alloc3k);
alloc4k = na->ops->alloc(na, SZ_4K);
if (alloc4k == 0) {
@@ -221,7 +221,7 @@ static int test_nvgpu_bitmap_allocator_alloc(struct unit_module *m,
"freeing unaligned base didn't trigger BUG()\n");
}
na->ops->free(na, alloc4k);
na->ops->free_alloc(na, alloc4k);
/*
* Allocate 4K

View File

@@ -181,7 +181,7 @@ static int test_buddy_allocator_with_big_pages(struct unit_module *m,
goto fail;
}
na->ops->free(na, addr1);
na->ops->free_alloc(na, addr1);
/*
* alloc_pte()
@@ -734,11 +734,11 @@ static int test_nvgpu_buddy_allocator_basic_ops(struct unit_module *m,
addr = na->ops->alloc(na, (SZ_64K >> 1));
na->ops->free(na, addr);
na->ops->free_alloc(na, addr);
na->ops->free(na, addr);
na->ops->free_alloc(na, addr);
na->ops->free(na, 0ULL);
na->ops->free_alloc(na, 0ULL);
/*
* len = 2M (requesting more than available memory)
@@ -751,7 +751,7 @@ static int test_nvgpu_buddy_allocator_basic_ops(struct unit_module *m,
addr = na->ops->alloc_pte(na, (SZ_4K << 2), SZ_1K << 1);
na->ops->free(na, addr);
na->ops->free_alloc(na, addr);
/*
* Unaligned base

View File

@@ -42,7 +42,7 @@
static bool dummy_op_called[OP_NUMBER];
static const char *ops_str[] = {
"alloc",
"free",
"free_alloc",
"alloc_pte",
"alloc_fixed",
"free fixed",
@@ -135,7 +135,7 @@ static void dummy_fini(struct nvgpu_allocator *allocator)
static struct nvgpu_allocator_ops dummy_ops = {
.alloc = dummy_alloc,
.free = dummy_free,
.free_alloc = dummy_free,
.alloc_pte = dummy_alloc_pte,
.alloc_fixed = dummy_alloc_fixed,
.free_fixed = dummy_free_fixed,
@@ -271,7 +271,7 @@ static int test_nvgpu_alloc_common_init(struct unit_module *m,
unit_return_fail(m,
"common_init passes despite missing free(),fini()\n");
ops.free = dummy_free;
ops.free_alloc = dummy_free;
if (nvgpu_alloc_common_init(&a, NULL, "test", NULL, false, &ops) == 0)
unit_return_fail(m,
"common_init passes despite missing fini()\n");
@@ -305,7 +305,7 @@ static int test_nvgpu_alloc_destroy(struct unit_module *m,
struct nvgpu_allocator zero_a = { };
struct nvgpu_allocator_ops ops = {
.alloc = dummy_alloc,
.free = dummy_free,
.free_alloc = dummy_free,
.fini = dummy_fini,
};

View File

@@ -267,7 +267,7 @@ static int test_page_free(struct unit_module *m, struct gk20a *g, void *args)
struct nvgpu_page_allocator *pa = page_allocator(na);
pa->flags |= param->flags;
na->ops->free(na, param->ret_addr);
na->ops->free_alloc(na, param->ret_addr);
pa->flags &= ~(param->flags);
return UNIT_SUCCESS;
@@ -430,7 +430,7 @@ static int test_page_allocator_sgt_ops(struct unit_module *m,
alloc->sgt.ops->sgt_free(g, &alloc->sgt);
na->ops->free(na, addr);
na->ops->free_alloc(na, addr);
return UNIT_SUCCESS;
}
@@ -490,7 +490,7 @@ static int test_nvgpu_page_allocator_ops(struct unit_module *m,
unit_return_fail(m, "reserved carveout after alloc\n");
}
na->ops->free(na, addr);
na->ops->free_alloc(na, addr);
return UNIT_SUCCESS;
}