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; } diff --git a/include/drivers/partition/efi.h b/include/drivers/partition/efi.h index e463f9657..96c285737 100644 --- a/include/drivers/partition/efi.h +++ b/include/drivers/partition/efi.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2021, Linaro Limited + * Copyright (c) 2022, STMicroelectronics - All Rights Reserved * * SPDX-License-Identifier: BSD-3-Clause * @@ -25,13 +26,13 @@ static inline void *guidcpy(void *dst, const void *src) } #define EFI_GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ - { (a) & 0xffffffff, \ - (b) & 0xffff, \ - (c) & 0xffff, \ + { (a) & 0xffffffffU, \ + (b) & 0xffffU, \ + (c) & 0xffffU, \ { (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) } } #define NULL_GUID \ - EFI_GUID(0x00000000, 0x0000, 0x0000, 0x00, 0x00, \ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00) + EFI_GUID(0x00000000U, 0x0000U, 0x0000U, 0x00U, 0x00U, \ + 0x00U, 0x00U, 0x00U, 0x00U, 0x00U, 0x00U) #endif /* DRIVERS_PARTITION_EFI_H */