From d28a401e6d872f7ea6abb0c5cfc8f63e0235fe21 Mon Sep 17 00:00:00 2001 From: Sai Nikhil Date: Wed, 22 Aug 2018 10:42:37 +0530 Subject: gpu: nvgpu: common: fix MISRA 10.4 violations 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. Jira NVGPU-992 Change-Id: Iab512139a025e035ec82a9dd74245bcf1f3869fb Signed-off-by: Sai Nikhil Reviewed-on: https://git-master.nvidia.com/r/1789425 Reviewed-by: svc-misra-checker GVS: Gerrit_Virtual_Submit Reviewed-by: Adeel Raza Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c') diff --git a/drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c b/drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c index 73893f2c..5d736591 100644 --- a/drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c +++ b/drivers/gpu/nvgpu/common/pmu/pmu_perfmon.c @@ -77,7 +77,7 @@ int nvgpu_pmu_init_perfmon(struct nvgpu_pmu *pmu) if (!pmu->sample_buffer) { pmu->sample_buffer = nvgpu_alloc(&pmu->dmem, - 2 * sizeof(u16)); + 2U * sizeof(u16)); } if (!pmu->sample_buffer) { nvgpu_err(g, "failed to allocate perfmon sample buffer"); @@ -215,7 +215,7 @@ int nvgpu_pmu_load_norm(struct gk20a *g, u32 *load) int nvgpu_pmu_load_update(struct gk20a *g) { struct nvgpu_pmu *pmu = &g->pmu; - u16 load = 0; + u32 load = 0; if (!pmu->perfmon_ready) { pmu->load_shadow = 0; @@ -231,8 +231,8 @@ int nvgpu_pmu_load_update(struct gk20a *g) (u8 *)&load, 2 * 1, 0); } - pmu->load_shadow = load / 10; - pmu->load_avg = (((9*pmu->load_avg) + pmu->load_shadow) / 10); + pmu->load_shadow = load / 10U; + pmu->load_avg = (((9U*pmu->load_avg) + pmu->load_shadow) / 10U); return 0; } -- cgit v1.2.2