summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMadhukar Pappireddy <madhukar.pappireddy@arm.com>2023-01-24 17:29:28 +0100
committerTrustedFirmware Code Review <review@review.trustedfirmware.org>2023-01-24 17:29:28 +0100
commitaa61ff6c9ffb8101edd0dcd333a678ae2d2ac9ba (patch)
tree1d0a0815b3a9f0f9aef796ed7ae0fe18939e367b /drivers
parentb6d4d73b88f564b53369503bb83d0a9a857502aa (diff)
parent53cbc949670877d1b661782ab452f6fac2302ce3 (diff)
downloadarm-trusted-firmware-aa61ff6c9ffb8101edd0dcd333a678ae2d2ac9ba.tar.gz
Merge changes from topic "fix_misra_partition_mmc" into integration
* changes: fix(mmc): align part config type fix(mmc): do not modify r_data in mmc_send_cmd() fix(mmc): explicitly check operators precedence fix(partition): add U suffix for unsigned numbers fix(partition): add missing curly braces
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mmc/mmc.c12
-rw-r--r--drivers/partition/gpt.c6
2 files changed, 9 insertions, 9 deletions
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 8e83464d5..2b727d4e7 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -69,8 +69,7 @@ static int mmc_send_cmd(unsigned int idx, unsigned int arg,
int i;
for (i = 0; i < 4; i++) {
- *r_data = cmd.resp_data[i];
- r_data++;
+ r_data[i] = cmd.resp_data[i];
}
}
@@ -112,7 +111,7 @@ static int mmc_device_state(void)
return MMC_GET_STATE(resp_data[0]);
}
-static int mmc_send_part_switch_cmd(unsigned int part_config)
+static int mmc_send_part_switch_cmd(unsigned char part_config)
{
int ret;
unsigned int part_time = 0;
@@ -760,9 +759,9 @@ size_t mmc_erase_blocks(int lba, size_t size)
return size;
}
-static int mmc_part_switch(unsigned int part_type)
+static int mmc_part_switch(unsigned char part_type)
{
- uint8_t part_config = mmc_ext_csd[CMD_EXTCSD_PARTITION_CONFIG];
+ unsigned char part_config = mmc_ext_csd[CMD_EXTCSD_PARTITION_CONFIG];
part_config &= ~EXT_CSD_PART_CONFIG_ACC_MASK;
part_config |= part_type;
@@ -780,8 +779,7 @@ int mmc_part_switch_current_boot(void)
unsigned char current_boot_part = mmc_current_boot_part();
int ret;
- if (current_boot_part != 1U &&
- current_boot_part != 2U) {
+ if ((current_boot_part != 1U) && (current_boot_part != 2U)) {
ERROR("Got unexpected value for active boot partition, %u\n", current_boot_part);
return -EIO;
}
diff --git a/drivers/partition/gpt.c b/drivers/partition/gpt.c
index 4fe832244..8b1046d00 100644
--- a/drivers/partition/gpt.c
+++ b/drivers/partition/gpt.c
@@ -26,14 +26,16 @@ static int unicode_to_ascii(unsigned short *str_in, unsigned char *str_out)
/* check whether the unicode string is valid */
for (i = 1; i < (EFI_NAMELEN << 1); i += 2) {
- if (name[i] != '\0')
+ if (name[i] != '\0') {
return -EINVAL;
+ }
}
/* convert the unicode string to ascii string */
for (i = 0; i < (EFI_NAMELEN << 1); i += 2) {
str_out[i >> 1] = name[i];
- if (name[i] == '\0')
+ if (name[i] == '\0') {
break;
+ }
}
return 0;
}