fix(zynqmp): align essential type categories

This corrects the MISRA violation C2012-10.7:
If a composite expression is used as one operand of an operator in
which the usual arithmetic conversions are performed then the other
operand shall not have wider essential type.
Explicitly type casted to match the data type of both the operands.

Change-Id: I670304682cc4945b8575f125ac750d0dc69079a7
Signed-off-by: Nithin G <nithing@amd.com>
Signed-off-by: Maheedhar Bollapalli <maheedharsai.bollapalli@amd.com>
This commit is contained in:
Maheedhar Bollapalli 2024-04-23 13:07:47 +05:30
parent e2cc129bcc
commit 1877bf2ce1
3 changed files with 8 additions and 8 deletions

View file

@ -2514,13 +2514,13 @@ enum pm_ret_status pm_api_clock_get_topology(uint32_t clock_id,
}
topology[i] = clock_nodes[index + i].type;
topology[i] |= clock_nodes[index + i].clkflags <<
CLK_CLKFLAGS_SHIFT;
topology[i] |= ((uint32_t)clock_nodes[index + i].clkflags <<
CLK_CLKFLAGS_SHIFT);
typeflags = clock_nodes[index + i].typeflags;
topology[i] |= (typeflags & CLK_TYPEFLAGS_BITS_MASK) <<
CLK_TYPEFLAGS_SHIFT;
topology[i] |= (typeflags & CLK_TYPEFLAGS2_BITS_MASK) >>
(CLK_TYPEFLAGS_BITS - CLK_TYPEFLAGS2_SHIFT);
topology[i] |= ((uint32_t)(typeflags & CLK_TYPEFLAGS_BITS_MASK) <<
CLK_TYPEFLAGS_SHIFT);
topology[i] |= ((uint32_t)(typeflags & CLK_TYPEFLAGS2_BITS_MASK) >>
(CLK_TYPEFLAGS_BITS - CLK_TYPEFLAGS2_SHIFT));
}
return PM_RET_SUCCESS;

View file

@ -198,7 +198,7 @@ static void pm_client_set_wakeup_sources(void)
for (reg_num = 0U; reg_num < NUM_GICD_ISENABLER; reg_num++) {
uint32_t base_irq = reg_num << ISENABLER_SHIFT;
uint32_t reg = mmio_read_32(isenabler1 + (reg_num << 2U));
uint32_t reg = mmio_read_32(isenabler1 + (uint64_t)(reg_num << 2U));
if (reg == 0) {
continue;

View file

@ -322,7 +322,7 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
uint32_t set_addr = pm_arg[1] & 0x1U;
uint64_t address = (uint64_t)pm_arg[2] << 32U;
address |= pm_arg[1] & (~0x1U);
address |= (uint64_t)(pm_arg[1] & (~0x1U));
ret = pm_req_wakeup(pm_arg[0], set_addr, address,
pm_arg[3]);
SMC_RET1(handle, (uint64_t)ret);