From 4d6fc3780cb8d4a1e644dd95e4f509e763d2d4cc Mon Sep 17 00:00:00 2001 From: Vedashree Vidwans Date: Fri, 21 Jun 2019 16:07:05 -0700 Subject: [PATCH] gpu: nvgpu: fix misra violations common.mm.vm This patch fixes misra violations in common/mm/vm.c. Rule 13.5 doesn't allow right hand operands of a logical operator to have persistent side effects. This patch translates logical operations to conditional operation. Change-Id: I83db6dba016eb353905a3887e7c47683b44b77d6 Signed-off-by: Vedashree Vidwans Reviewed-on: https://git-master.nvidia.com/r/2140974 Reviewed-by: Scott Long Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/vm.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/nvgpu/common/mm/vm.c b/drivers/gpu/nvgpu/common/mm/vm.c index fcef2994c..2c0a1206b 100644 --- a/drivers/gpu/nvgpu/common/mm/vm.c +++ b/drivers/gpu/nvgpu/common/mm/vm.c @@ -532,14 +532,18 @@ int nvgpu_vm_do_init(struct mm_gk20a *mm, * Determine if big pages are possible in this VM. If a split address * space is used then check the user_lp vma instead of the user vma. */ - if (unified_va) { - vm->big_pages = big_pages && - nvgpu_big_pages_possible(vm, user_vma_start, + if (big_pages) { + if (unified_va) { + vm->big_pages = nvgpu_big_pages_possible(vm, + user_vma_start, user_vma_limit - user_vma_start); - } else { - vm->big_pages = big_pages && - nvgpu_big_pages_possible(vm, user_lp_vma_start, + } else { + vm->big_pages = nvgpu_big_pages_possible(vm, + user_lp_vma_start, user_lp_vma_limit - user_lp_vma_start); + } + } else { + vm->big_pages = false; } /*