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 <snikhil@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1789425
Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Adeel Raza <araza@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Sai Nikhil
2018-08-22 10:42:37 +05:30
committed by mobile promotions
parent 650171566b
commit d28a401e6d
11 changed files with 107 additions and 107 deletions

View File

@@ -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;
}