fix(versal-net): typecast operands to match data type

This corrects the MISRA violation C2012-10.3:
The value of an expression shall not be assigned to an object with a
narrower essential type or of a different essential type category.
The condition is explicitly checked against 0U, appending 'U' and
typecasting for unsigned comparison.

Change-Id: Ie2d32d5554d251cde8a9c8b7c7a85666ea505a15
Signed-off-by: Maheedhar Bollapalli <maheedharsai.bollapalli@amd.com>
This commit is contained in:
Maheedhar Bollapalli 2024-10-22 06:53:27 +00:00
parent 3a1a2dae10
commit d51c8e4c65
4 changed files with 7 additions and 6 deletions

View file

@ -55,7 +55,7 @@ static inline void bl31_set_default_config(void)
bl32_image_ep_info.pc = BL32_BASE;
bl32_image_ep_info.spsr = arm_get_spsr_for_bl32_entry();
bl33_image_ep_info.pc = plat_get_ns_image_entrypoint();
bl33_image_ep_info.spsr = SPSR_64(MODE_EL2, MODE_SP_ELX,
bl33_image_ep_info.spsr = (uint32_t)SPSR_64(MODE_EL2, MODE_SP_ELX,
DISABLE_ALL_EXCEPTIONS);
}

View file

@ -245,7 +245,7 @@ static int32_t versal_net_validate_power_state(unsigned int power_state,
{
VERBOSE("%s: power_state: 0x%x\n", __func__, power_state);
int32_t pstate = psci_get_pstate_type(power_state);
uint32_t pstate = psci_get_pstate_type(power_state);
assert(req_state != NULL);

View file

@ -44,8 +44,8 @@ int32_t plat_core_pos_by_mpidr(u_register_t mpidr)
mpidr &= MPIDR_AFFINITY_MASK;
cluster_id = MPIDR_AFFLVL2_VAL(mpidr);
cpu_id = MPIDR_AFFLVL1_VAL(mpidr);
cluster_id = (uint32_t)MPIDR_AFFLVL2_VAL(mpidr);
cpu_id = (uint32_t)MPIDR_AFFLVL1_VAL(mpidr);
if (cluster_id >= PLATFORM_CLUSTER_COUNT) {
return -3;
@ -59,5 +59,5 @@ int32_t plat_core_pos_by_mpidr(u_register_t mpidr)
return -1;
}
return (cpu_id + (cluster_id * PLATFORM_CORE_COUNT_PER_CLUSTER));
return (int32_t)(cpu_id + (cluster_id * PLATFORM_CORE_COUNT_PER_CLUSTER));
}

View file

@ -341,8 +341,9 @@ void pm_client_suspend(const struct pm_proc *proc, uint32_t state)
static uint32_t pm_get_cpuid(uint32_t nid)
{
uint32_t ret = UNDEFINED_CPUID;
uint32_t i;
for (size_t i = 0; i < ARRAY_SIZE(pm_procs_all); i++) {
for (i = 0; i < ARRAY_SIZE(pm_procs_all); i++) {
if (pm_procs_all[i].node_id == nid) {
ret = i;
break;