Browse Source

fix(plat/xilinx/versal): resolve misra R10.1 in pm services

MISRA Violation: MISRA-C:2012 R.10.1
- Operands shall not be of an inappropriate essential type.

Signed-off-by: Abhyuday Godhasara <abhyuday.godhasara@xilinx.com>
Change-Id: I67b5788054a136be8d764472c5d85528a5c4272f
pull/1978/merge
Abhyuday Godhasara 3 years ago
parent
commit
775bf1bbd3
  1. 4
      plat/xilinx/versal/pm_service/pm_api_sys.c
  2. 10
      plat/xilinx/versal/pm_service/pm_client.c
  3. 6
      plat/xilinx/versal/pm_service/pm_svc_main.c

4
plat/xilinx/versal/pm_service/pm_api_sys.c

@ -130,7 +130,7 @@ enum pm_ret_status pm_self_suspend(uint32_t nid,
unsigned int cpuid = plat_my_core_pos();
const struct pm_proc *proc = pm_get_proc(cpuid);
if (!proc) {
if (proc == NULL) {
WARN("Failed to get proc %d\n", cpuid);
return PM_RET_ERROR_INTERNAL;
}
@ -373,7 +373,7 @@ enum pm_ret_status pm_reset_get_status(uint32_t reset, uint32_t *status,
void pm_get_callbackdata(uint32_t *data, size_t count, uint32_t flag)
{
/* Return if interrupt is not from PMU */
if (!pm_ipi_irq_status(primary_proc)) {
if (pm_ipi_irq_status(primary_proc) == 0) {
return;
}

10
plat/xilinx/versal/pm_service/pm_client.c

@ -128,11 +128,11 @@ static void pm_client_set_wakeup_sources(uint32_t node_id)
uint32_t base_irq = reg_num << ISENABLER_SHIFT;
uint32_t reg = mmio_read_32(isenabler1 + (reg_num << 2));
if (!reg) {
if (reg == 0U) {
continue;
}
while (reg) {
while (reg != 0U) {
enum pm_device_node_idx node_idx;
uint32_t idx, irq, lowest_set = reg & (-reg);
enum pm_ret_status ret;
@ -147,7 +147,7 @@ static void pm_client_set_wakeup_sources(uint32_t node_id)
reg &= ~lowest_set;
if ((node_idx != XPM_NODEIDX_DEV_MIN) &&
(!pm_wakeup_nodes_set[node_idx])) {
(pm_wakeup_nodes_set[node_idx] == 0U)) {
/* Get device ID from node index */
device_id = PERIPH_DEVID(node_idx);
ret = pm_set_wakeup_source(node_id,
@ -176,7 +176,7 @@ void pm_client_suspend(const struct pm_proc *proc, unsigned int state)
/* Set powerdown request */
mmio_write_32(FPD_APU_PWRCTL, mmio_read_32(FPD_APU_PWRCTL) |
proc->pwrdn_mask);
(uint32_t)proc->pwrdn_mask);
bakery_lock_release(&pm_client_secure_lock);
}
@ -196,7 +196,7 @@ void pm_client_abort_suspend(void)
/* Clear powerdown request */
mmio_write_32(FPD_APU_PWRCTL, mmio_read_32(FPD_APU_PWRCTL) &
~primary_proc->pwrdn_mask);
~((uint32_t)primary_proc->pwrdn_mask));
bakery_lock_release(&pm_client_secure_lock);
}

6
plat/xilinx/versal/pm_service/pm_svc_main.c

@ -107,7 +107,7 @@ int pm_setup(void)
pm_ipi_irq_enable(primary_proc);
ret = request_intr_type_el3(PLAT_VERSAL_IPI_IRQ, ipi_fiq_handler);
if (ret) {
if (ret != 0) {
WARN("BL31: registering IPI interrupt failed\n");
}
return ret;
@ -138,7 +138,7 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
uint32_t security_flag = SECURE_FLAG;
/* Handle case where PM wasn't initialized properly */
if (!pm_up) {
if (pm_up == false) {
SMC_RET1(handle, SMC_UNK);
}
@ -151,7 +151,7 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
* Mark BIT24 payload (i.e 1st bit of pm_arg[3] ) as non-secure (1)
* if smc called is non secure
*/
if (is_caller_non_secure(flags)) {
if (is_caller_non_secure(flags) != 0) {
security_flag = NON_SECURE_FLAG;
}

Loading…
Cancel
Save