fix(arm): resolve misra rule R11.6 violation
Fixed below MISRA violation:
- MISRA violation: MC3R1.R11.6:
- A cast shall not be performed between a pointer to void and an
arithmetic data type. (i.e cast from integer to void*)
- Fix:
- cast via portable and misra compliant type "uintptr_t" and
use 0U instead of NULL for comparisons.
Signed-off-by: Jayanth Dodderi Chidanand <jayanthdodderi.chidanand@arm.com>
Change-Id: Ie3a7561d9a254027c5364485a1d72fc1320dfcad
diff --git a/plat/arm/common/arm_bl31_setup.c b/plat/arm/common/arm_bl31_setup.c
index bf2d8cd..fa35bb2 100644
--- a/plat/arm/common/arm_bl31_setup.c
+++ b/plat/arm/common/arm_bl31_setup.c
@@ -211,8 +211,8 @@
#else /* (!TRANSFER_LIST) */
#if RESET_TO_BL31
/* There are no parameters from BL2 if BL31 is a reset vector */
- assert((void *)arg0 == NULL);
- assert((void *)arg3 == NULL);
+ assert((uintptr_t)arg0 == 0U);
+ assert((uintptr_t)arg3 == 0U);
# ifdef BL32_BASE
/* Populate entry point information for BL32 */
@@ -257,12 +257,12 @@
* to verify platform parameters from BL2 to BL31.
* In release builds, it's not used.
*/
- assert(((unsigned long long)arg3) == ARM_BL31_PLAT_PARAM_VAL);
+ assert(((uintptr_t)arg3) == ARM_BL31_PLAT_PARAM_VAL);
/*
* Check params passed from BL2 should not be NULL,
*/
- bl_params_t *params_from_bl2 = (bl_params_t *)arg0;
+ bl_params_t *params_from_bl2 = (bl_params_t *)(uintptr_t)arg0;
assert(params_from_bl2 != NULL);
assert(params_from_bl2->h.type == PARAM_BL_PARAMS);
assert(params_from_bl2->h.version >= VERSION_2);