plat/arm: Fix MISRA defects in dyn config
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>
Tue, 30 Oct 2018 16:32:48 +0000 (16:32 +0000)
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>
Thu, 1 Nov 2018 14:15:39 +0000 (14:15 +0000)
Change-Id: Iae6758ca6395560131d1e1a69a1ecfe50ca8bf83
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
include/plat/arm/common/arm_dyn_cfg_helpers.h
plat/arm/common/arm_dyn_cfg.c

index cb17c95f254fc7ffd2621f28ee535b9402f1cf7a..3ad6d5468be708a9a64cdf42c25211d97931a37f 100644 (file)
@@ -3,8 +3,8 @@
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
-#ifndef __ARM_DYN_CFG_HELPERS_H__
-#define __ARM_DYN_CFG_HELPERS_H__
+#ifndef ARM_DYN_CFG_HELPERS_H
+#define ARM_DYN_CFG_HELPERS_H
 
 #include <stddef.h>
 #include <stdint.h>
@@ -19,4 +19,4 @@ int arm_get_dtb_mbedtls_heap_info(void *dtb, void **heap_addr,
 int arm_set_dtb_mbedtls_heap_info(void *dtb, void *heap_addr,
        size_t heap_size);
 
-#endif /* __ARM_DYN_CFG_HELPERS_H__ */
+#endif /* ARM_DYN_CFG_HELPERS_H */
index 057d772f24ae82de21b2d5447901fff87508c809..c2a4bb1e65cfd100dbc8689101f33c36c719a793 100644 (file)
@@ -122,8 +122,8 @@ void arm_bl1_set_mbedtls_heap(void)
 void arm_load_tb_fw_config(void)
 {
        int err;
-       uintptr_t config_base = 0;
-       image_desc_t *image_desc;
+       uintptr_t config_base = 0UL;
+       image_desc_t *desc;
 
        image_desc_t arm_tb_fw_info = {
                .image_id = TB_FW_CONFIG_ID,
@@ -148,12 +148,11 @@ void arm_load_tb_fw_config(void)
        tb_fw_cfg_dtb_size = (size_t)arm_tb_fw_info.image_info.image_max_size;
 
        /* The BL2 ep_info arg0 is modified to point to TB_FW_CONFIG */
-       image_desc = bl1_plat_get_image_desc(BL2_IMAGE_ID);
-       assert(image_desc != NULL);
-       image_desc->ep_info.args.arg0 = config_base;
+       desc = bl1_plat_get_image_desc(BL2_IMAGE_ID);
+       assert(desc != NULL);
+       desc->ep_info.args.arg0 = config_base;
 
-       INFO("BL1: TB_FW_CONFIG loaded at address = %p\n",
-                       (void *) config_base);
+       INFO("BL1: TB_FW_CONFIG loaded at address = 0x%lx\n", config_base);
 
 #if TRUSTED_BOARD_BOOT && defined(DYN_DISABLE_AUTH)
        int tb_fw_node;
@@ -240,7 +239,7 @@ void arm_bl2_dyn_cfg_init(void)
                 */
                if (config_ids[i] != HW_CONFIG_ID) {
 
-                       if (check_uptr_overflow(image_base, image_size) != 0)
+                       if (check_uptr_overflow(image_base, image_size))
                                continue;
 
                        /* Ensure the configs don't overlap with BL31 */