From 41a1212744cf597a68f585feb47feb4b4baced92 Mon Sep 17 00:00:00 2001 From: srajum Date: Tue, 24 Aug 2021 17:40:12 +0530 Subject: [PATCH] gpu: nvgpu: fixing MISRA 10.1 and 10.3 violations - MISRA Rule 10.1 The expression "g->syncpt_size" of non-boolean essential type is being interpreted as a boolean value for the operator "? :". - MISRA Rule 10.3 Implicit conversion of "(tmp <= 4294967295UL) ? tmp : 4294967295UL" from essential type "unsigned 64-bit int" to different or narrower essential type "unsigned 32-bit int" JIRA NVGPU-6536 Change-Id: I56f01a13f3a8877317213d6fc846330ff3dfd700 Signed-off-by: srajum Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2582289 (cherry picked from commit 4a51cad9b016a17ddec00cd6b35ec6c931a3c5c4) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2674865 Reviewed-by: svcacv Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-cert Reviewed-by: svc-mobile-misra Reviewed-by: Rajesh Devaraj Reviewed-by: Vaibhav Kachore GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/hal/sync/syncpt_cmdbuf_gv11b_fusa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/hal/sync/syncpt_cmdbuf_gv11b_fusa.c b/drivers/gpu/nvgpu/hal/sync/syncpt_cmdbuf_gv11b_fusa.c index faa9b8099..4e1a4db73 100644 --- a/drivers/gpu/nvgpu/hal/sync/syncpt_cmdbuf_gv11b_fusa.c +++ b/drivers/gpu/nvgpu/hal/sync/syncpt_cmdbuf_gv11b_fusa.c @@ -120,7 +120,7 @@ int gv11b_syncpt_get_sync_ro_map(struct vm_gk20a *vm, *base_gpuva = vm->syncpt_ro_map_gpu_va; *sync_size = g->syncpt_size; - tmp = g->syncpt_size ? (g->syncpt_unit_size / g->syncpt_size) : 0U; + tmp = (g->syncpt_size != 0UL) ? (g->syncpt_unit_size / g->syncpt_size) : 0U; *num_syncpoints = (tmp <= U32_MAX) ? (u32)tmp : U32_MAX; return 0;