fix(platforms): modify function to have single return

This corrects the MISRA violation C2012-15.5:
A function should have a single point of exit at the end.
Introduced a temporary variable to store the return value to
ensure single return for the function.

Change-Id: I9c2ca05b506a6ac35b24966fc5fdd5e88e65770d
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-25 14:46:28 +05:30
parent 858dc35cfd
commit 50029b9ac3
2 changed files with 27 additions and 13 deletions

View file

@ -78,19 +78,27 @@ int plat_sdei_validate_entry_point(uintptr_t ep, unsigned int client_mode)
const char *get_el_str(unsigned int el)
{
const char *mode = NULL;
switch (el) {
case MODE_EL3:
return "EL3";
mode = "EL3";
break;
case MODE_EL2:
return "EL2";
mode = "EL2";
break;
case MODE_EL1:
return "EL1";
mode = "EL1";
break;
case MODE_EL0:
return "EL0";
mode = "EL0";
break;
default:
assert(false);
return NULL;
break;
}
return mode;
}
#if FFH_SUPPORT

View file

@ -48,8 +48,9 @@ uint32_t plat_ic_get_pending_interrupt_id(void)
unsigned int id;
id = gicv2_get_pending_interrupt_id();
if (id == GIC_SPURIOUS_INTERRUPT)
return INTR_ID_UNAVAILABLE;
if (id == GIC_SPURIOUS_INTERRUPT) {
id = INTR_ID_UNAVAILABLE;
}
return id;
}
@ -68,22 +69,27 @@ uint32_t plat_ic_get_pending_interrupt_id(void)
uint32_t plat_ic_get_pending_interrupt_type(void)
{
unsigned int id;
uint32_t interrupt_type;
id = gicv2_get_pending_interrupt_type();
/* Assume that all secure interrupts are S-EL1 interrupts */
if (id < PENDING_G1_INTID) {
#if GICV2_G0_FOR_EL3
return INTR_TYPE_EL3;
interrupt_type = INTR_TYPE_EL3;
#else
return INTR_TYPE_S_EL1;
interrupt_type = INTR_TYPE_S_EL1;
#endif
} else {
if (id == GIC_SPURIOUS_INTERRUPT) {
interrupt_type = INTR_TYPE_INVAL;
} else {
interrupt_type = INTR_TYPE_NS;
}
}
if (id == GIC_SPURIOUS_INTERRUPT) {
return INTR_TYPE_INVAL;
}
return INTR_TYPE_NS;
return interrupt_type;
}
/*