From d77785800b2ae4c27354500305303c395a18acf4 Mon Sep 17 00:00:00 2001 From: Sai Nikhil Date: Thu, 30 Aug 2018 13:35:00 +0530 Subject: gpu: nvgpu: volt: fix MISRA Rule 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 fixes violation where an arithmetic operation is performed on signed and unsigned int types. JIRA NVGPU-992 Change-Id: Ic9a911beb6d161df950ca85eb4813547603a8743 Signed-off-by: Sai Nikhil Reviewed-on: https://git-master.nvidia.com/r/1809751 Reviewed-by: svc-misra-checker GVS: Gerrit_Virtual_Submit Reviewed-by: Adeel Raza Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/volt/volt_dev.c | 8 ++++---- drivers/gpu/nvgpu/volt/volt_dev.h | 4 ++-- drivers/gpu/nvgpu/volt/volt_pmu.c | 2 +- drivers/gpu/nvgpu/volt/volt_policy.c | 4 ++-- drivers/gpu/nvgpu/volt/volt_rail.c | 10 +++++----- drivers/gpu/nvgpu/volt/volt_rail.h | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'drivers/gpu/nvgpu/volt') diff --git a/drivers/gpu/nvgpu/volt/volt_dev.c b/drivers/gpu/nvgpu/volt/volt_dev.c index fccd3b03..bb5d1821 100644 --- a/drivers/gpu/nvgpu/volt/volt_dev.c +++ b/drivers/gpu/nvgpu/volt/volt_dev.c @@ -35,8 +35,8 @@ #include "volt.h" -#define VOLT_DEV_PWM_VOLTAGE_STEPS_INVALID 0 -#define VOLT_DEV_PWM_VOLTAGE_STEPS_DEFAULT 1 +#define VOLT_DEV_PWM_VOLTAGE_STEPS_INVALID 0U +#define VOLT_DEV_PWM_VOLTAGE_STEPS_DEFAULT 1U static int volt_device_pmu_data_init_super(struct gk20a *g, struct boardobj *pboard_obj, struct nv_pmu_boardobj *ppmudata) @@ -425,7 +425,7 @@ static int _volt_device_devgrp_pmudata_instget(struct gk20a *g, /*check whether pmuboardobjgrp has a valid boardobj in index*/ if (((u32)BIT(idx) & - pgrp_set->hdr.data.super.obj_mask.super.data[0]) == 0) { + pgrp_set->hdr.data.super.obj_mask.super.data[0]) == 0U) { return -EINVAL; } @@ -445,7 +445,7 @@ static int _volt_device_devgrp_pmustatus_instget(struct gk20a *g, /*check whether pmuboardobjgrp has a valid boardobj in index*/ if (((u32)BIT(idx) & - pgrp_get_status->hdr.data.super.obj_mask.super.data[0]) == 0) { + pgrp_get_status->hdr.data.super.obj_mask.super.data[0]) == 0U) { return -EINVAL; } diff --git a/drivers/gpu/nvgpu/volt/volt_dev.h b/drivers/gpu/nvgpu/volt/volt_dev.h index eb1868cb..48d93aea 100644 --- a/drivers/gpu/nvgpu/volt/volt_dev.h +++ b/drivers/gpu/nvgpu/volt/volt_dev.h @@ -27,8 +27,8 @@ #include "boardobj/boardobjgrp.h" #include "ctrl/ctrlvolt.h" -#define VOLTAGE_TABLE_MAX_ENTRIES_ONE 1 -#define VOLTAGE_TABLE_MAX_ENTRIES 256 +#define VOLTAGE_TABLE_MAX_ENTRIES_ONE 1U +#define VOLTAGE_TABLE_MAX_ENTRIES 256U struct voltage_device { struct boardobj super; diff --git a/drivers/gpu/nvgpu/volt/volt_pmu.c b/drivers/gpu/nvgpu/volt/volt_pmu.c index 184aa5d0..2249ae24 100644 --- a/drivers/gpu/nvgpu/volt/volt_pmu.c +++ b/drivers/gpu/nvgpu/volt/volt_pmu.c @@ -108,7 +108,7 @@ static u32 volt_pmu_rpc_execute(struct gk20a *g, gk20a_get_gr_idle_timeout(g), &handler.success, 1); - if (handler.success == 0) { + if (handler.success == 0U) { status = -EINVAL; nvgpu_err(g, "rpc call to volt failed"); } diff --git a/drivers/gpu/nvgpu/volt/volt_policy.c b/drivers/gpu/nvgpu/volt/volt_policy.c index 4f9d7ad8..cc60730d 100644 --- a/drivers/gpu/nvgpu/volt/volt_policy.c +++ b/drivers/gpu/nvgpu/volt/volt_policy.c @@ -382,7 +382,7 @@ static int _volt_policy_devgrp_pmudata_instget(struct gk20a *g, /*check whether pmuboardobjgrp has a valid boardobj in index*/ if (((u32)BIT(idx) & - pgrp_set->hdr.data.super.obj_mask.super.data[0]) == 0) { + pgrp_set->hdr.data.super.obj_mask.super.data[0]) == 0U) { return -EINVAL; } @@ -402,7 +402,7 @@ static int _volt_policy_devgrp_pmustatus_instget(struct gk20a *g, /*check whether pmuboardobjgrp has a valid boardobj in index*/ if (((u32)BIT(idx) & - p_get_status->hdr.data.super.obj_mask.super.data[0]) == 0) { + p_get_status->hdr.data.super.obj_mask.super.data[0]) == 0U) { return -EINVAL; } diff --git a/drivers/gpu/nvgpu/volt/volt_rail.c b/drivers/gpu/nvgpu/volt/volt_rail.c index 37e85761..caf297f0 100644 --- a/drivers/gpu/nvgpu/volt/volt_rail.c +++ b/drivers/gpu/nvgpu/volt/volt_rail.c @@ -105,7 +105,7 @@ static u32 volt_rail_state_init(struct gk20a *g, pvolt_rail->volt_dev_idx_default = CTRL_BOARDOBJ_IDX_INVALID; for (i = 0; i < CTRL_VOLT_RAIL_VOLT_DELTA_MAX_ENTRIES; i++) { - pvolt_rail->volt_delta_uv[i] = NV_PMU_VOLT_VALUE_0V_IN_UV; + pvolt_rail->volt_delta_uv[i] = (int)NV_PMU_VOLT_VALUE_0V_IN_UV; g->perf_pmu.volt.volt_rail_metadata.ext_rel_delta_uv[i] = NV_PMU_VOLT_VALUE_0V_IN_UV; } @@ -162,7 +162,7 @@ static int volt_rail_init_pmudata_super(struct gk20a *g, for (i = 0; i < CTRL_VOLT_RAIL_VOLT_DELTA_MAX_ENTRIES; i++) { rail_pmu_data->volt_delta_uv[i] = prail->volt_delta_uv[i] + - g->perf_pmu.volt.volt_rail_metadata.ext_rel_delta_uv[i]; + (int)g->perf_pmu.volt.volt_rail_metadata.ext_rel_delta_uv[i]; } status = boardobjgrpmask_export(&prail->volt_dev_mask.super, @@ -225,7 +225,7 @@ u8 volt_rail_vbios_volt_domain_convert_to_internal(struct gk20a *g, { switch (g->perf_pmu.volt.volt_rail_metadata.volt_domain_hal) { case CTRL_VOLT_DOMAIN_HAL_GP10X_SINGLE_RAIL: - if (vbios_volt_domain == 0) { + if (vbios_volt_domain == 0U) { return CTRL_VOLT_DOMAIN_LOGIC; } break; @@ -382,7 +382,7 @@ static int _volt_rail_devgrp_pmudata_instget(struct gk20a *g, /*check whether pmuboardobjgrp has a valid boardobj in index*/ if (((u32)BIT(idx) & - pgrp_set->hdr.data.super.obj_mask.super.data[0]) == 0) { + pgrp_set->hdr.data.super.obj_mask.super.data[0]) == 0U) { return -EINVAL; } @@ -402,7 +402,7 @@ static int _volt_rail_devgrp_pmustatus_instget(struct gk20a *g, /*check whether pmuboardobjgrp has a valid boardobj in index*/ if (((u32)BIT(idx) & - pgrp_get_status->hdr.data.super.obj_mask.super.data[0]) == 0) { + pgrp_get_status->hdr.data.super.obj_mask.super.data[0]) == 0U) { return -EINVAL; } diff --git a/drivers/gpu/nvgpu/volt/volt_rail.h b/drivers/gpu/nvgpu/volt/volt_rail.h index 522d635a..72bb2546 100644 --- a/drivers/gpu/nvgpu/volt/volt_rail.h +++ b/drivers/gpu/nvgpu/volt/volt_rail.h @@ -27,8 +27,8 @@ #include "boardobj/boardobj.h" #include "boardobj/boardobjgrp.h" -#define CTRL_VOLT_RAIL_VOLT_DELTA_MAX_ENTRIES 0x04 -#define CTRL_PMGR_PWR_EQUATION_INDEX_INVALID 0xFF +#define CTRL_VOLT_RAIL_VOLT_DELTA_MAX_ENTRIES 0x04U +#define CTRL_PMGR_PWR_EQUATION_INDEX_INVALID 0xFFU #define VOLT_GET_VOLT_RAIL(pvolt, rail_idx) \ ((struct voltage_rail *)BOARDOBJGRP_OBJ_GET_BY_IDX( \ -- cgit v1.2.2