Skip to content

Commit aa61ff6

Browse files
madhukar-ArmTrustedFirmware Code Review
authored andcommitted
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
2 parents b6d4d73 + 53cbc94 commit aa61ff6

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

drivers/mmc/mmc.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ static int mmc_send_cmd(unsigned int idx, unsigned int arg,
6969
int i;
7070

7171
for (i = 0; i < 4; i++) {
72-
*r_data = cmd.resp_data[i];
73-
r_data++;
72+
r_data[i] = cmd.resp_data[i];
7473
}
7574
}
7675

@@ -112,7 +111,7 @@ static int mmc_device_state(void)
112111
return MMC_GET_STATE(resp_data[0]);
113112
}
114113

115-
static int mmc_send_part_switch_cmd(unsigned int part_config)
114+
static int mmc_send_part_switch_cmd(unsigned char part_config)
116115
{
117116
int ret;
118117
unsigned int part_time = 0;
@@ -760,9 +759,9 @@ size_t mmc_erase_blocks(int lba, size_t size)
760759
return size;
761760
}
762761

763-
static int mmc_part_switch(unsigned int part_type)
762+
static int mmc_part_switch(unsigned char part_type)
764763
{
765-
uint8_t part_config = mmc_ext_csd[CMD_EXTCSD_PARTITION_CONFIG];
764+
unsigned char part_config = mmc_ext_csd[CMD_EXTCSD_PARTITION_CONFIG];
766765

767766
part_config &= ~EXT_CSD_PART_CONFIG_ACC_MASK;
768767
part_config |= part_type;
@@ -780,8 +779,7 @@ int mmc_part_switch_current_boot(void)
780779
unsigned char current_boot_part = mmc_current_boot_part();
781780
int ret;
782781

783-
if (current_boot_part != 1U &&
784-
current_boot_part != 2U) {
782+
if ((current_boot_part != 1U) && (current_boot_part != 2U)) {
785783
ERROR("Got unexpected value for active boot partition, %u\n", current_boot_part);
786784
return -EIO;
787785
}

drivers/partition/gpt.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ static int unicode_to_ascii(unsigned short *str_in, unsigned char *str_out)
2626

2727
/* check whether the unicode string is valid */
2828
for (i = 1; i < (EFI_NAMELEN << 1); i += 2) {
29-
if (name[i] != '\0')
29+
if (name[i] != '\0') {
3030
return -EINVAL;
31+
}
3132
}
3233
/* convert the unicode string to ascii string */
3334
for (i = 0; i < (EFI_NAMELEN << 1); i += 2) {
3435
str_out[i >> 1] = name[i];
35-
if (name[i] == '\0')
36+
if (name[i] == '\0') {
3637
break;
38+
}
3739
}
3840
return 0;
3941
}

include/drivers/partition/efi.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (c) 2021, Linaro Limited
3+
* Copyright (c) 2022, STMicroelectronics - All Rights Reserved
34
*
45
* SPDX-License-Identifier: BSD-3-Clause
56
*
@@ -25,13 +26,13 @@ static inline void *guidcpy(void *dst, const void *src)
2526
}
2627

2728
#define EFI_GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
28-
{ (a) & 0xffffffff, \
29-
(b) & 0xffff, \
30-
(c) & 0xffff, \
29+
{ (a) & 0xffffffffU, \
30+
(b) & 0xffffU, \
31+
(c) & 0xffffU, \
3132
{ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) } }
3233

3334
#define NULL_GUID \
34-
EFI_GUID(0x00000000, 0x0000, 0x0000, 0x00, 0x00, \
35-
0x00, 0x00, 0x00, 0x00, 0x00, 0x00)
35+
EFI_GUID(0x00000000U, 0x0000U, 0x0000U, 0x00U, 0x00U, \
36+
0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U)
3637

3738
#endif /* DRIVERS_PARTITION_EFI_H */

0 commit comments

Comments
 (0)