Commit da5f2745 authored by Soby Mathew's avatar Soby Mathew
Browse files

Dynamic cfg: MISRA fixes



Change-Id: I1d85b76af002b8b672fcaeca94939b7420bc8243
Signed-off-by: default avatarSoby Mathew <soby.mathew@arm.com>
parent ce6d9643
...@@ -202,7 +202,7 @@ void populate_next_bl_params_config(bl_params_t *bl2_to_next_bl_params) ...@@ -202,7 +202,7 @@ void populate_next_bl_params_config(bl_params_t *bl2_to_next_bl_params)
uintptr_t hw_config_base = 0, fw_config_base; uintptr_t hw_config_base = 0, fw_config_base;
bl_mem_params_node_t *mem_params; bl_mem_params_node_t *mem_params;
assert(bl2_to_next_bl_params); assert(bl2_to_next_bl_params != NULL);
/* /*
* Get the `bl_mem_params_node_t` corresponding to HW_CONFIG * Get the `bl_mem_params_node_t` corresponding to HW_CONFIG
......
...@@ -23,16 +23,16 @@ int fdtw_read_cells(const void *dtb, int node, const char *prop, ...@@ -23,16 +23,16 @@ int fdtw_read_cells(const void *dtb, int node, const char *prop,
uint32_t hi = 0, lo; uint32_t hi = 0, lo;
int value_len; int value_len;
assert(dtb); assert(dtb != NULL);
assert(prop); assert(prop != NULL);
assert(value); assert(value != NULL);
assert(node >= 0); assert(node >= 0);
/* We expect either 1 or 2 cell property */ /* We expect either 1 or 2 cell property */
assert(cells <= 2); assert(cells <= 2U);
/* Access property and obtain its length (in bytes) */ /* Access property and obtain its length (in bytes) */
value_ptr = fdt_getprop_namelen(dtb, node, prop, strlen(prop), value_ptr = fdt_getprop_namelen(dtb, node, prop, (int)strlen(prop),
&value_len); &value_len);
if (value_ptr == NULL) { if (value_ptr == NULL) {
WARN("Couldn't find property %s in dtb\n", prop); WARN("Couldn't find property %s in dtb\n", prop);
...@@ -41,19 +41,19 @@ int fdtw_read_cells(const void *dtb, int node, const char *prop, ...@@ -41,19 +41,19 @@ int fdtw_read_cells(const void *dtb, int node, const char *prop,
/* Verify that property length accords with cell length */ /* Verify that property length accords with cell length */
if (NCELLS(value_len) != cells) { if (NCELLS((unsigned int)value_len) != cells) {
WARN("Property length mismatch\n"); WARN("Property length mismatch\n");
return -1; return -1;
} }
if (cells == 2) { if (cells == 2U) {
hi = fdt32_to_cpu(*value_ptr); hi = fdt32_to_cpu(*value_ptr);
value_ptr++; value_ptr++;
} }
lo = fdt32_to_cpu(*value_ptr); lo = fdt32_to_cpu(*value_ptr);
if (cells == 2) if (cells == 2U)
*((uint64_t *) value) = ((uint64_t) hi << 32) | lo; *((uint64_t *) value) = ((uint64_t) hi << 32) | lo;
else else
*((uint32_t *) value) = lo; *((uint32_t *) value) = lo;
...@@ -70,20 +70,20 @@ int fdtw_write_inplace_cells(void *dtb, int node, const char *prop, ...@@ -70,20 +70,20 @@ int fdtw_write_inplace_cells(void *dtb, int node, const char *prop,
{ {
int err, len; int err, len;
assert(dtb); assert(dtb != NULL);
assert(prop); assert(prop != NULL);
assert(value); assert(value != NULL);
assert(node >= 0); assert(node >= 0);
/* We expect either 1 or 2 cell property */ /* We expect either 1 or 2 cell property */
assert(cells <= 2); assert(cells <= 2U);
if (cells == 2) if (cells == 2U)
*(uint64_t *)value = cpu_to_fdt64(*(uint64_t *)value); *(uint64_t *)value = cpu_to_fdt64(*(uint64_t *)value);
else else
*(uint32_t *)value = cpu_to_fdt32(*(uint32_t *)value); *(uint32_t *)value = cpu_to_fdt32(*(uint32_t *)value);
len = cells * 4; len = (int)cells * 4;
/* Set property value in place */ /* Set property value in place */
err = fdt_setprop_inplace(dtb, node, prop, value, len); err = fdt_setprop_inplace(dtb, node, prop, value, len);
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <ep_info.h> #include <ep_info.h>
#include <param_header.h> #include <param_header.h>
#include <utils_def.h>
#define UP 1 #define UP 1
#define DOWN 0 #define DOWN 0
...@@ -31,10 +32,10 @@ ...@@ -31,10 +32,10 @@
#define IMAGE_STATE_EXECUTED 4 #define IMAGE_STATE_EXECUTED 4
#define IMAGE_STATE_INTERRUPTED 5 #define IMAGE_STATE_INTERRUPTED 5
#define IMAGE_ATTRIB_SKIP_LOADING 0x02 #define IMAGE_ATTRIB_SKIP_LOADING U(0x02)
#define IMAGE_ATTRIB_PLAT_SETUP 0x04 #define IMAGE_ATTRIB_PLAT_SETUP U(0x04)
#define INVALID_IMAGE_ID (0xFFFFFFFF) #define INVALID_IMAGE_ID U(0xFFFFFFFF)
/******************************************************************************* /*******************************************************************************
* Constants to indicate type of exception to the common exception handler. * Constants to indicate type of exception to the common exception handler.
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#define __FDT_WRAPPERS__ #define __FDT_WRAPPERS__
/* Number of cells, given total length in bytes. Each cell is 4 bytes long */ /* Number of cells, given total length in bytes. Each cell is 4 bytes long */
#define NCELLS(l) (l / 4) #define NCELLS(len) ((len) / 4)
int fdtw_read_cells(const void *dtb, int node, const char *prop, int fdtw_read_cells(const void *dtb, int node, const char *prop,
unsigned int cells, void *value); unsigned int cells, void *value);
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <generic_delay_timer.h> #include <generic_delay_timer.h>
#include <mmio.h> #include <mmio.h>
#include <plat_arm.h> #include <plat_arm.h>
#include <platform.h>
#include <sp804_delay_timer.h> #include <sp804_delay_timer.h>
#include <v2m_def.h> #include <v2m_def.h>
#include "fvp_def.h" #include "fvp_def.h"
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <arm_config.h> #include <arm_config.h>
#include <plat_arm.h> #include <plat_arm.h>
#include <platform.h>
#include <smmu_v3.h> #include <smmu_v3.h>
#include "fvp_private.h" #include "fvp_private.h"
......
...@@ -194,7 +194,7 @@ void arm_bl2_early_platform_setup(uintptr_t tb_fw_config, meminfo_t *mem_layout) ...@@ -194,7 +194,7 @@ void arm_bl2_early_platform_setup(uintptr_t tb_fw_config, meminfo_t *mem_layout)
plat_arm_io_setup(); plat_arm_io_setup();
#if LOAD_IMAGE_V2 #if LOAD_IMAGE_V2
if (tb_fw_config != 0) if (tb_fw_config != 0U)
arm_bl2_set_tb_cfg_addr((void *)tb_fw_config); arm_bl2_set_tb_cfg_addr((void *)tb_fw_config);
#endif #endif
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <assert.h> #include <assert.h>
#include <debug.h> #include <debug.h>
#include <desc_image_load.h> #include <desc_image_load.h>
#include <plat_arm.h>
#include <platform.h> #include <platform.h>
#include <platform_def.h> #include <platform_def.h>
#include <string.h> #include <string.h>
...@@ -38,7 +39,7 @@ void arm_load_tb_fw_config(void) ...@@ -38,7 +39,7 @@ void arm_load_tb_fw_config(void)
VERBOSE("BL1: Loading TB_FW_CONFIG\n"); VERBOSE("BL1: Loading TB_FW_CONFIG\n");
err = load_auth_image(TB_FW_CONFIG_ID, &arm_tb_fw_info.image_info); err = load_auth_image(TB_FW_CONFIG_ID, &arm_tb_fw_info.image_info);
if (err) { if (err != 0) {
/* Return if TB_FW_CONFIG is not loaded */ /* Return if TB_FW_CONFIG is not loaded */
VERBOSE("Failed to load TB_FW_CONFIG\n"); VERBOSE("Failed to load TB_FW_CONFIG\n");
return; return;
...@@ -48,7 +49,7 @@ void arm_load_tb_fw_config(void) ...@@ -48,7 +49,7 @@ void arm_load_tb_fw_config(void)
/* The BL2 ep_info arg0 is modified to point to TB_FW_CONFIG */ /* The BL2 ep_info arg0 is modified to point to TB_FW_CONFIG */
image_desc = bl1_plat_get_image_desc(BL2_IMAGE_ID); image_desc = bl1_plat_get_image_desc(BL2_IMAGE_ID);
assert(image_desc); assert(image_desc != NULL);
image_desc->ep_info.args.arg0 = config_base; image_desc->ep_info.args.arg0 = config_base;
INFO("BL1: TB_FW_CONFIG loaded at address = %p\n", INFO("BL1: TB_FW_CONFIG loaded at address = %p\n",
...@@ -60,7 +61,7 @@ void arm_load_tb_fw_config(void) ...@@ -60,7 +61,7 @@ void arm_load_tb_fw_config(void)
*/ */
void arm_bl2_set_tb_cfg_addr(void *dtb) void arm_bl2_set_tb_cfg_addr(void *dtb)
{ {
assert(dtb); assert(dtb != NULL);
tb_fw_cfg_dtb = dtb; tb_fw_cfg_dtb = dtb;
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <desc_image_load.h> #include <desc_image_load.h>
#include <fdt_wrappers.h> #include <fdt_wrappers.h>
#include <libfdt.h> #include <libfdt.h>
#include <plat_arm.h>
/******************************************************************************* /*******************************************************************************
* Helper to read the `hw_config` property in config DTB. This function * Helper to read the `hw_config` property in config DTB. This function
...@@ -31,9 +32,9 @@ int arm_dyn_get_hwconfig_info(void *dtb, int node, ...@@ -31,9 +32,9 @@ int arm_dyn_get_hwconfig_info(void *dtb, int node,
{ {
int err; int err;
assert(dtb); assert(dtb != NULL);
assert(hw_config_addr); assert(hw_config_addr != NULL);
assert(hw_config_size); assert(hw_config_size != NULL);
/* Check if the pointer to DT is correct */ /* Check if the pointer to DT is correct */
assert(fdt_check_header(dtb) == 0); assert(fdt_check_header(dtb) == 0);
...@@ -72,8 +73,8 @@ int arm_dyn_get_hwconfig_info(void *dtb, int node, ...@@ -72,8 +73,8 @@ int arm_dyn_get_hwconfig_info(void *dtb, int node,
******************************************************************************/ ******************************************************************************/
int arm_dyn_tb_fw_cfg_init(void *dtb, int *node) int arm_dyn_tb_fw_cfg_init(void *dtb, int *node)
{ {
assert(dtb); assert(dtb != NULL);
assert(node); assert(node != NULL);
/* Check if the pointer to DT is correct */ /* Check if the pointer to DT is correct */
if (fdt_check_header(dtb) != 0) { if (fdt_check_header(dtb) != 0) {
......
...@@ -89,7 +89,7 @@ int bl1_plat_handle_post_image_load(unsigned int image_id) ...@@ -89,7 +89,7 @@ int bl1_plat_handle_post_image_load(unsigned int image_id)
/* Get the image descriptor */ /* Get the image descriptor */
image_desc = bl1_plat_get_image_desc(BL2_IMAGE_ID); image_desc = bl1_plat_get_image_desc(BL2_IMAGE_ID);
assert(image_desc); assert(image_desc != NULL);
/* Get the entry point info */ /* Get the entry point info */
ep_info = &image_desc->ep_info; ep_info = &image_desc->ep_info;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment