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/bitmap_allocator.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/common/mm/bitmap_allocator.c') diff --git a/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c b/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c index 5316783d..1edfda51 100644 --- a/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/bitmap_allocator.c @@ -378,7 +378,7 @@ int nvgpu_bitmap_allocator_init(struct gk20a *g, struct nvgpu_allocator *na, int err; struct nvgpu_bitmap_allocator *a; - if (WARN_ON(blk_size & (blk_size - 1))) { + if (WARN_ON(blk_size & (blk_size - 1U))) { return -EINVAL; } @@ -386,12 +386,12 @@ int nvgpu_bitmap_allocator_init(struct gk20a *g, struct nvgpu_allocator *na, * blk_size must be a power-of-2; base length also need to be aligned * to blk_size. */ - if (blk_size & (blk_size - 1) || - base & (blk_size - 1) || length & (blk_size - 1)) { + if (blk_size & (blk_size - 1U) || + base & (blk_size - 1U) || length & (blk_size - 1U)) { return -EINVAL; } - if (base == 0) { + if (base == 0U) { base = blk_size; length -= blk_size; } -- cgit v1.2.2