From 7e288d11a5f155de4d6ad2ab9827fd71c0c9f74e Mon Sep 17 00:00:00 2001 From: Maheedhar Bollapalli Date: Thu, 25 Apr 2024 10:34:02 +0530 Subject: [PATCH] fix(platforms): add missing curly braces This corrects the MISRA violation C2012-15.6: The body of an iteration-statement or a selection-statement shall be a compound-statement. Enclosed statement body within the curly braces. Change-Id: I1327a206782ccd341c0c7eaa3f26078150458ed0 Signed-off-by: Nithin G Signed-off-by: Maheedhar Bollapalli --- plat/common/plat_bl_common.c | 3 ++- plat/common/plat_gicv2.c | 10 ++++++---- plat/common/plat_psci_common.c | 8 +++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/plat/common/plat_bl_common.c b/plat/common/plat_bl_common.c index dbb6f81f7..4772bada9 100644 --- a/plat/common/plat_bl_common.c +++ b/plat/common/plat_bl_common.c @@ -51,8 +51,9 @@ void bl2_el3_plat_prepare_exit(void) void __dead2 plat_error_handler(int err) { - while (1) + while (1) { wfi(); + } } void bl2_plat_preload_setup(void) diff --git a/plat/common/plat_gicv2.c b/plat/common/plat_gicv2.c index f78d2dfc6..05df97add 100644 --- a/plat/common/plat_gicv2.c +++ b/plat/common/plat_gicv2.c @@ -80,9 +80,9 @@ uint32_t plat_ic_get_pending_interrupt_type(void) #endif } - if (id == GIC_SPURIOUS_INTERRUPT) + if (id == GIC_SPURIOUS_INTERRUPT) { return INTR_TYPE_INVAL; - + } return INTR_TYPE_NS; } @@ -142,8 +142,9 @@ uint32_t plat_interrupt_type_to_line(uint32_t type, assert(sec_state_is_valid(security_state)); /* Non-secure interrupts are signaled on the IRQ line always */ - if (type == INTR_TYPE_NS) + if (type == INTR_TYPE_NS) { return __builtin_ctz(SCR_IRQ_BIT); + } /* * Secure interrupts are signaled using the IRQ line if the FIQ is @@ -329,8 +330,9 @@ unsigned int plat_ic_get_interrupt_id(unsigned int raw) { unsigned int id = (raw & INT_ID_MASK); - if (id == GIC_SPURIOUS_INTERRUPT) + if (id == GIC_SPURIOUS_INTERRUPT) { id = INTR_ID_UNAVAILABLE; + } return id; } diff --git a/plat/common/plat_psci_common.c b/plat/common/plat_psci_common.c index 4cea0b9ae..72b79adb6 100644 --- a/plat/common/plat_psci_common.c +++ b/plat/common/plat_psci_common.c @@ -59,10 +59,11 @@ static u_register_t calc_stat_residency(unsigned long long pwrupts, residency_div = read_cntfrq_el0() / MHZ_TICKS_PER_SEC; assert(residency_div > 0U); - if (pwrupts < pwrdnts) + if (pwrupts < pwrdnts) { res = MAX_TS - pwrdnts + pwrupts; - else + } else { res = pwrupts - pwrdnts; + } return res / residency_div; } @@ -170,8 +171,9 @@ plat_local_state_t plat_get_target_pwr_state(unsigned int lvl, do { temp = *st; st++; - if (temp < target) + if (temp < target) { target = temp; + } n--; } while (n > 0U);