From 0eeda638a8a6e8d9ff0448ba7405a8a5b86d17e0 Mon Sep 17 00:00:00 2001 From: Maheedhar Bollapalli Date: Thu, 25 Apr 2024 10:46:18 +0530 Subject: [PATCH] fix(common): 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: I934b0f5c3b2500940054360611a035fcefa6a690 Signed-off-by: Nithin G Signed-off-by: Maheedhar Bollapalli --- common/runtime_svc.c | 27 ++++++++++++++------------- common/tf_log.c | 7 ++++--- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/common/runtime_svc.c b/common/runtime_svc.c index a2c0c09e1..cbba6216a 100644 --- a/common/runtime_svc.c +++ b/common/runtime_svc.c @@ -60,23 +60,23 @@ uintptr_t handle_runtime_svc(uint32_t smc_fid, ******************************************************************************/ static int32_t validate_rt_svc_desc(const rt_svc_desc_t *desc) { - if (desc == NULL) + if (desc == NULL) { return -EINVAL; - - if (desc->start_oen > desc->end_oen) + } + if (desc->start_oen > desc->end_oen) { return -EINVAL; - - if (desc->end_oen >= OEN_LIMIT) + } + if (desc->end_oen >= OEN_LIMIT) { return -EINVAL; - + } if ((desc->call_type != SMC_TYPE_FAST) && - (desc->call_type != SMC_TYPE_YIELD)) + (desc->call_type != SMC_TYPE_YIELD)) { return -EINVAL; - + } /* A runtime service having no init or handle function doesn't make sense */ - if ((desc->init == NULL) && (desc->handle == NULL)) + if ((desc->init == NULL) && (desc->handle == NULL)) { return -EINVAL; - + } return 0; } @@ -98,9 +98,9 @@ void __init runtime_svc_init(void) (RT_SVC_DECS_NUM < MAX_RT_SVCS)); /* If no runtime services are implemented then simply bail out */ - if (RT_SVC_DECS_NUM == 0U) + if (RT_SVC_DECS_NUM == 0U) { return; - + } /* Initialise internal variables to invalid state */ (void)memset(rt_svc_descs_indices, -1, sizeof(rt_svc_descs_indices)); @@ -148,7 +148,8 @@ void __init runtime_svc_init(void) service->call_type); assert(start_idx <= end_idx); assert(end_idx < MAX_RT_SVCS); - for (; start_idx <= end_idx; start_idx++) + for (; start_idx <= end_idx; start_idx++) { rt_svc_descs_indices[start_idx] = index; + } } } diff --git a/common/tf_log.c b/common/tf_log.c index 68f1be49a..2d976f61d 100644 --- a/common/tf_log.c +++ b/common/tf_log.c @@ -34,9 +34,9 @@ void tf_log(const char *fmt, ...) assert((log_level > 0U) && (log_level <= LOG_LEVEL_VERBOSE)); assert((log_level % 10U) == 0U); - if (log_level > max_log_level) + if (log_level > max_log_level) { return; - + } prefix_str = plat_log_get_prefix(log_level); while (*prefix_str != '\0') { @@ -57,8 +57,9 @@ void tf_log_newline(const char log_fmt[2]) assert((log_level > 0U) && (log_level <= LOG_LEVEL_VERBOSE)); assert((log_level % 10U) == 0U); - if (log_level > max_log_level) + if (log_level > max_log_level) { return; + } putchar('\n'); }