Fix MISRA Rule 5.7 Part 3
Rule 5.7: A tag name shall be a unique identifier
Follow convention of shorter names for smaller scope to fix
violations of MISRA rule 5.7
Fixed For:
make ARM_TSP_RAM_LOCATION=tdram LOG_LEVEL=50 PLAT=fvp SPD=opteed
Change-Id: I5fbb5d6ebddf169550eddb07ed880f5c8076bb76
Signed-off-by: Daniel Boulby <daniel.boulby@arm.com>
diff --git a/lib/optee/optee_utils.c b/lib/optee/optee_utils.c
index ac51265..ecf7cc0 100644
--- a/lib/optee/optee_utils.c
+++ b/lib/optee/optee_utils.c
@@ -43,7 +43,7 @@
uint8_t arch;
uint16_t flags;
uint32_t nb_images;
- optee_image_t optee_image[];
+ optee_image_t optee_image_list[];
} optee_header_t;
/*******************************************************************************
@@ -51,11 +51,11 @@
* Return 1 if valid
* Return 0 if invalid
******************************************************************************/
-static inline int tee_validate_header(optee_header_t *optee_header)
+static inline int tee_validate_header(optee_header_t *header)
{
- if ((optee_header->magic == TEE_MAGIC_NUM_OPTEE) &&
- (optee_header->version == 2) &&
- (optee_header->nb_images <= OPTEE_MAX_IMAGE_NUM)) {
+ if ((header->magic == TEE_MAGIC_NUM_OPTEE) &&
+ (header->version == 2) &&
+ (header->nb_images <= OPTEE_MAX_IMAGE_NUM)) {
return 1;
}
@@ -68,14 +68,14 @@
* Return 0 on success or a negative error code otherwise.
******************************************************************************/
static int parse_optee_image(image_info_t *image_info,
- optee_image_t *optee_image)
+ optee_image_t *image)
{
uintptr_t init_load_addr, free_end, requested_end;
size_t init_size;
- init_load_addr = ((uint64_t)optee_image->load_addr_hi << 32) |
- optee_image->load_addr_lo;
- init_size = optee_image->size;
+ init_load_addr = ((uint64_t)image->load_addr_hi << 32) |
+ image->load_addr_lo;
+ init_size = image->size;
/*
* -1 indicates loader decided address; take our pre-mapped area
@@ -133,21 +133,21 @@
image_info_t *paged_image_info)
{
- optee_header_t *optee_header;
+ optee_header_t *header;
int num, ret;
assert(header_ep);
- optee_header = (optee_header_t *)header_ep->pc;
- assert(optee_header);
+ header = (optee_header_t *)header_ep->pc;
+ assert(header);
/* Print the OPTEE header information */
INFO("OPTEE ep=0x%x\n", (unsigned int)header_ep->pc);
INFO("OPTEE header info:\n");
- INFO(" magic=0x%x\n", optee_header->magic);
- INFO(" version=0x%x\n", optee_header->version);
- INFO(" arch=0x%x\n", optee_header->arch);
- INFO(" flags=0x%x\n", optee_header->flags);
- INFO(" nb_images=0x%x\n", optee_header->nb_images);
+ INFO(" magic=0x%x\n", header->magic);
+ INFO(" version=0x%x\n", header->version);
+ INFO(" arch=0x%x\n", header->arch);
+ INFO(" flags=0x%x\n", header->flags);
+ INFO(" nb_images=0x%x\n", header->nb_images);
/*
* OPTEE image has 3 types:
@@ -166,7 +166,7 @@
* pager and pageable. Remove skip attr for BL32_EXTRA1_IMAGE_ID
* and BL32_EXTRA2_IMAGE_ID to load pager and paged bin.
*/
- if (!tee_validate_header(optee_header)) {
+ if (!tee_validate_header(header)) {
INFO("Invalid OPTEE header, set legacy mode.\n");
#ifdef AARCH64
header_ep->args.arg0 = MODE_RW_64;
@@ -177,15 +177,15 @@
}
/* Parse OPTEE image */
- for (num = 0; num < optee_header->nb_images; num++) {
- if (optee_header->optee_image[num].image_id ==
+ for (num = 0; num < header->nb_images; num++) {
+ if (header->optee_image_list[num].image_id ==
OPTEE_PAGER_IMAGE_ID) {
ret = parse_optee_image(pager_image_info,
- &optee_header->optee_image[num]);
- } else if (optee_header->optee_image[num].image_id ==
+ &header->optee_image_list[num]);
+ } else if (header->optee_image_list[num].image_id ==
OPTEE_PAGED_IMAGE_ID) {
ret = parse_optee_image(paged_image_info,
- &optee_header->optee_image[num]);
+ &header->optee_image_list[num]);
} else {
ERROR("Parse optee image failed.\n");
return -1;
@@ -211,7 +211,7 @@
header_ep->args.arg2 = paged_image_info->image_size;
/* Set OPTEE runtime arch - aarch32/aarch64 */
- if (optee_header->arch == 0) {
+ if (header->arch == 0) {
header_ep->args.arg0 = MODE_RW_32;
} else {
#ifdef AARCH64