Hi,
On 1/17/24 10:24, Nithin G via TF-A wrote:
Yes, I will put return "EL1" into an else statement to enhance the code structure. But we have a situation where the return statement is not present. What can we do with the below code to fix this violation?
Event misra_c_2012_rule_15_7_violation: No non-empty terminating "else" statement. if() {
} else if () {
}
I don't understand... If we massage the code like this:
const char *get_el_str(unsigned int el) { if (el == MODE_EL3) { return "EL3"; } else if (el == MODE_EL2) { return "EL2"; } else { return "EL1"; } }
where do you a situation where the return statement is not present? I see return statements in all cases: EL3, EL2 and anything else.
Regards, Sandrine