From b86e1aade1c0953bd60ae0b35f1c3571ee8bae3f Mon Sep 17 00:00:00 2001 From: Venkatesh Yadav Abbarapu Date: Wed, 20 Jul 2022 09:03:22 +0530 Subject: [PATCH] feat(versal): resolve the misra 10.1 warnings MISRA Violation: MISRA-C:2012 R.10.1 -The operand to the operator does not have an essentially unsigned type. Signed-off-by: Venkatesh Yadav Abbarapu Change-Id: I9cde2f1ebceaad8a41c69489ef1d2e6f21f04ed1 --- plat/xilinx/versal/include/plat_pm_common.h | 6 +++--- plat/xilinx/versal/include/platform_def.h | 2 +- plat/xilinx/versal/pm_service/pm_api_sys.c | 6 +++--- plat/xilinx/versal/pm_service/pm_svc_main.c | 14 +++++++------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/plat/xilinx/versal/include/plat_pm_common.h b/plat/xilinx/versal/include/plat_pm_common.h index 22c9d1182..fb4812dad 100644 --- a/plat/xilinx/versal/include/plat_pm_common.h +++ b/plat/xilinx/versal/include/plat_pm_common.h @@ -19,8 +19,8 @@ #define NON_SECURE_FLAG 1U #define SECURE_FLAG 0U -#define VERSAL_TZ_VERSION_MAJOR 1 -#define VERSAL_TZ_VERSION_MINOR 0 -#define VERSAL_TZ_VERSION ((VERSAL_TZ_VERSION_MAJOR << 16) | \ +#define VERSAL_TZ_VERSION_MAJOR 1U +#define VERSAL_TZ_VERSION_MINOR 0U +#define VERSAL_TZ_VERSION ((VERSAL_TZ_VERSION_MAJOR << 16U) | \ VERSAL_TZ_VERSION_MINOR) #endif /* PLAT_PM_COMMON_H */ diff --git a/plat/xilinx/versal/include/platform_def.h b/plat/xilinx/versal/include/platform_def.h index 83e508392..6d95fdc5f 100644 --- a/plat/xilinx/versal/include/platform_def.h +++ b/plat/xilinx/versal/include/platform_def.h @@ -15,7 +15,7 @@ ******************************************************************************/ /* Size of cacheable stacks */ -#define PLATFORM_STACK_SIZE 0x440 +#define PLATFORM_STACK_SIZE U(0x440) #define PLATFORM_CORE_COUNT U(2) #define PLAT_MAX_PWR_LVL U(1) diff --git a/plat/xilinx/versal/pm_service/pm_api_sys.c b/plat/xilinx/versal/pm_service/pm_api_sys.c index 27bfaed74..e464d3212 100644 --- a/plat/xilinx/versal/pm_service/pm_api_sys.c +++ b/plat/xilinx/versal/pm_service/pm_api_sys.c @@ -49,7 +49,7 @@ enum pm_ret_status pm_handle_eemi_call(uint32_t flag, uint32_t x0, uint32_t x1, uint32_t payload[PAYLOAD_ARG_CNT] = {0}; uint32_t module_id; - module_id = (x0 & MODULE_ID_MASK) >> 8; + module_id = (x0 & MODULE_ID_MASK) >> 8U; //default module id is for LIBPM if (module_id == 0) { @@ -397,7 +397,7 @@ enum pm_ret_status pm_query_data(uint32_t qid, uint32_t arg1, uint32_t arg2, ret = pm_feature_check(PM_QUERY_DATA, &version[0], flag); if (ret == PM_RET_SUCCESS) { - fw_api_version = version[0] & 0xFFFF; + fw_api_version = version[0] & 0xFFFFU; if ((fw_api_version == 2U) && ((qid == XPM_QID_CLOCK_GET_NAME) || (qid == XPM_QID_PINCTRL_GET_FUNCTION_NAME))) { @@ -521,7 +521,7 @@ enum pm_ret_status pm_feature_check(uint32_t api_id, uint32_t *ret_payload, break; } - module_id = (api_id & MODULE_ID_MASK) >> 8; + module_id = (api_id & MODULE_ID_MASK) >> 8U; /* * feature check should be done only for LIBPM module diff --git a/plat/xilinx/versal/pm_service/pm_svc_main.c b/plat/xilinx/versal/pm_service/pm_svc_main.c index f4d04b823..4b0f5e06b 100644 --- a/plat/xilinx/versal/pm_service/pm_svc_main.c +++ b/plat/xilinx/versal/pm_service/pm_svc_main.c @@ -156,8 +156,8 @@ static uintptr_t eemi_for_compatibility(uint32_t api_id, uint32_t *pm_arg, ret = pm_query_data(pm_arg[0], pm_arg[1], pm_arg[2], pm_arg[3], data, security_flag); - SMC_RET2(handle, (uint64_t)ret | ((uint64_t)data[0] << 32), - (uint64_t)data[1] | ((uint64_t)data[2] << 32)); + SMC_RET2(handle, (uint64_t)ret | ((uint64_t)data[0] << 32U), + (uint64_t)data[1] | ((uint64_t)data[2] << 32U)); } case PM_FEATURE_CHECK: @@ -165,8 +165,8 @@ static uintptr_t eemi_for_compatibility(uint32_t api_id, uint32_t *pm_arg, uint32_t result[PAYLOAD_ARG_CNT] = {0U}; ret = pm_feature_check(pm_arg[0], result, security_flag); - SMC_RET2(handle, (uint64_t)ret | ((uint64_t)result[0] << 32), - (uint64_t)result[1] | ((uint64_t)result[2] << 32)); + SMC_RET2(handle, (uint64_t)ret | ((uint64_t)result[0] << 32U), + (uint64_t)result[1] | ((uint64_t)result[2] << 32U)); } case PM_LOAD_PDI: @@ -255,13 +255,13 @@ static uintptr_t TF_A_specific_handler(uint32_t api_id, uint32_t *pm_arg, pm_get_callbackdata(result, ARRAY_SIZE(result), security_flag); SMC_RET2(handle, - (uint64_t)result[0] | ((uint64_t)result[1] << 32), - (uint64_t)result[2] | ((uint64_t)result[3] << 32)); + (uint64_t)result[0] | ((uint64_t)result[1] << 32U), + (uint64_t)result[2] | ((uint64_t)result[3] << 32U)); } case PM_GET_TRUSTZONE_VERSION: SMC_RET1(handle, (uint64_t)PM_RET_SUCCESS | - ((uint64_t)VERSAL_TZ_VERSION << 32)); + ((uint64_t)VERSAL_TZ_VERSION << 32U)); default: return (uintptr_t)0;