From 2f97e683feed3c3ba3c8722c4f6ab7466bcef0c0 Mon Sep 17 00:00:00 2001 From: Sai Nikhil Date: Fri, 17 Aug 2018 10:50:17 +0530 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1784419 Reviewed-by: svc-misra-checker Reviewed-by: Adeel Raza GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/page_allocator.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/gpu/nvgpu/common/mm/page_allocator.c') 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, palloc_dbg(a, "Freeing slab page @ 0x%012llx", slab_page->page_addr); BUG_ON((slab_page->state != SP_NONE && slab_page->state != SP_EMPTY) || - slab_page->nr_objects_alloced != 0 || - slab_page->bitmap != 0); + slab_page->nr_objects_alloced != 0U || + slab_page->bitmap != 0U); nvgpu_free(&a->source_allocator, slab_page->page_addr); a->pages_freed++; @@ -471,7 +471,7 @@ static void __nvgpu_free_slab(struct nvgpu_page_allocator *a, slab_page->nr_objects_alloced--; - if (slab_page->nr_objects_alloced == 0) { + if (slab_page->nr_objects_alloced == 0U) { new_state = SP_EMPTY; } else { new_state = SP_PARTIAL; @@ -684,7 +684,7 @@ static u64 nvgpu_page_alloc(struct nvgpu_allocator *na, u64 len) alloc_lock(na); if (a->flags & GPU_ALLOC_4K_VIDMEM_PAGES && - real_len <= (a->page_size / 2)) { + real_len <= (a->page_size / 2U)) { alloc = __nvgpu_alloc_slab(a, real_len); } else { alloc = __nvgpu_alloc_pages(a, real_len); @@ -698,7 +698,7 @@ static u64 nvgpu_page_alloc(struct nvgpu_allocator *na, u64 len) __insert_page_alloc(a, alloc); a->nr_allocs++; - if (real_len > a->page_size / 2) { + if (real_len > a->page_size / 2U) { a->pages_alloced += alloc->length >> a->page_shift; } alloc_unlock(na); -- cgit v1.2.2