From 471ea46f91fb16734e2e8ee9f3ff6178b4788689 Mon Sep 17 00:00:00 2001 From: Seeta Rama Raju Date: Tue, 17 Nov 2020 17:22:50 +0530 Subject: [PATCH] gpu: nvgpu: Fix for MISRA 10.3, 10.4 violation - Implicit conversion from essential type "signed 32-bit int" to "unsigned 64-bit int". - Essential type of the left hand operand "32UL" (unsigned) is not the same as that of the right operand "1"(signed) JIRA NVGPU-6055 Change-Id: I22b0e345b851b33faca0b09c42a57b80b9f4f620 Signed-off-by: Seeta Rama Raju Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2447254 (cherry picked from commit 1e035ad03ad19cf89f248b3b4e83f734aa646e8c) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2454502 Reviewed-by: automaticguardword Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Vaibhav Kachore Reviewed-by: mobile promotions Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/sync/channel_user_syncpt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/nvgpu/common/sync/channel_user_syncpt.c b/drivers/gpu/nvgpu/common/sync/channel_user_syncpt.c index 52e93876e..5c53fc2ba 100644 --- a/drivers/gpu/nvgpu/common/sync/channel_user_syncpt.c +++ b/drivers/gpu/nvgpu/common/sync/channel_user_syncpt.c @@ -52,9 +52,9 @@ static int user_sync_build_debug_name(struct nvgpu_channel *ch, nvgpu_err(g, "strnadd failed!"); return -EINVAL; } - capacity = nvgpu_safe_sub_u64(capacity, n); + capacity = nvgpu_safe_sub_u64(capacity, nvgpu_safe_cast_s32_to_u64(n)); /* nul byte */ - capacity = nvgpu_safe_sub_u64(capacity, 1); + capacity = nvgpu_safe_sub_u64(capacity, 1UL); (void)strncat(buf, "_user", capacity); /* make sure it didn't get truncated */ @@ -80,7 +80,7 @@ nvgpu_channel_user_syncpt_create(struct nvgpu_channel *ch) s->nvhost = g->nvhost; err = user_sync_build_debug_name(ch, syncpt_name, - sizeof(syncpt_name) - 1); + sizeof(syncpt_name) - 1UL); if (err < 0) { goto err_free; }