summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/mm/page_allocator.c
diff options
context:
space:
mode:
authorSai Nikhil <snikhil@nvidia.com>2018-08-17 01:20:17 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-08-29 11:59:31 -0400
commit2f97e683feed3c3ba3c8722c4f6ab7466bcef0c0 (patch)
treec0f90c3dc6909122cfde071efff8ff24d2b61471 /drivers/gpu/nvgpu/common/mm/page_allocator.c
parent19cd7ffb5def933db323fe682ec4a263eb1923f9 (diff)
gpu: nvgpu: common: fix MISRA Rule 10.4
MISRA Rule 10.4 only allows the usage of arithmetic operations on operands of the same essential type category. Adding "U" at the end of the integer literals to have same type of operands when an arithmetic operation is performed. This fix violations where an arithmetic operation is performed on signed and unsigned int types. In balloc_get_order_list() the argument "int order" has been changed to a u64 because all callers of this function pass a u64 argument. JIRA NVGPU-992 Change-Id: Ie2964f9f1dfb2865a9bd6e6cdd65e7cda6c1f638 Signed-off-by: Sai Nikhil <snikhil@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1784419 Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> Reviewed-by: Adeel Raza <araza@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>
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm/page_allocator.c')
-rw-r--r--drivers/gpu/nvgpu/common/mm/page_allocator.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/page_allocator.c b/drivers/gpu/nvgpu/common/mm/page_allocator.c
index f6d70435..3225f170 100644
--- a/drivers/gpu/nvgpu/common/mm/page_allocator.c
+++ b/drivers/gpu/nvgpu/common/mm/page_allocator.c
@@ -317,8 +317,8 @@ static void free_slab_page(struct nvgpu_page_allocator *a,
317 palloc_dbg(a, "Freeing slab page @ 0x%012llx", slab_page->page_addr); 317 palloc_dbg(a, "Freeing slab page @ 0x%012llx", slab_page->page_addr);
318 318
319 BUG_ON((slab_page->state != SP_NONE && slab_page->state != SP_EMPTY) || 319 BUG_ON((slab_page->state != SP_NONE && slab_page->state != SP_EMPTY) ||
320 slab_page->nr_objects_alloced != 0 || 320 slab_page->nr_objects_alloced != 0U ||
321 slab_page->bitmap != 0); 321 slab_page->bitmap != 0U);
322 322
323 nvgpu_free(&a->source_allocator, slab_page->page_addr); 323 nvgpu_free(&a->source_allocator, slab_page->page_addr);
324 a->pages_freed++; 324 a->pages_freed++;
@@ -471,7 +471,7 @@ static void __nvgpu_free_slab(struct nvgpu_page_allocator *a,
471 471
472 slab_page->nr_objects_alloced--; 472 slab_page->nr_objects_alloced--;
473 473
474 if (slab_page->nr_objects_alloced == 0) { 474 if (slab_page->nr_objects_alloced == 0U) {
475 new_state = SP_EMPTY; 475 new_state = SP_EMPTY;
476 } else { 476 } else {
477 new_state = SP_PARTIAL; 477 new_state = SP_PARTIAL;
@@ -684,7 +684,7 @@ static u64 nvgpu_page_alloc(struct nvgpu_allocator *na, u64 len)
684 684
685 alloc_lock(na); 685 alloc_lock(na);
686 if (a->flags & GPU_ALLOC_4K_VIDMEM_PAGES && 686 if (a->flags & GPU_ALLOC_4K_VIDMEM_PAGES &&
687 real_len <= (a->page_size / 2)) { 687 real_len <= (a->page_size / 2U)) {
688 alloc = __nvgpu_alloc_slab(a, real_len); 688 alloc = __nvgpu_alloc_slab(a, real_len);
689 } else { 689 } else {
690 alloc = __nvgpu_alloc_pages(a, real_len); 690 alloc = __nvgpu_alloc_pages(a, real_len);
@@ -698,7 +698,7 @@ static u64 nvgpu_page_alloc(struct nvgpu_allocator *na, u64 len)
698 __insert_page_alloc(a, alloc); 698 __insert_page_alloc(a, alloc);
699 699
700 a->nr_allocs++; 700 a->nr_allocs++;
701 if (real_len > a->page_size / 2) { 701 if (real_len > a->page_size / 2U) {
702 a->pages_alloced += alloc->length >> a->page_shift; 702 a->pages_alloced += alloc->length >> a->page_shift;
703 } 703 }
704 alloc_unlock(na); 704 alloc_unlock(na);