This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push: new 788f8fc495 esp32s3_partition.c: Appease a compiler warning (-Wdiscarded-qualifiers) 788f8fc495 is described below commit 788f8fc495c5bd538d0d852b8937a1d85d4a39bf Author: YAMAMOTO Takashi <yamam...@midokura.com> AuthorDate: Thu Nov 7 15:06:12 2024 +0900 esp32s3_partition.c: Appease a compiler warning (-Wdiscarded-qualifiers) --- arch/xtensa/src/esp32s3/esp32s3_partition.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/xtensa/src/esp32s3/esp32s3_partition.c b/arch/xtensa/src/esp32s3/esp32s3_partition.c index 04a2307eca..50ce146e9c 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_partition.c +++ b/arch/xtensa/src/esp32s3/esp32s3_partition.c @@ -769,6 +769,8 @@ int esp32s3_partition_init(void) encrypt = esp32s3_flash_encryption_enabled(); for (i = 0; i < num; i++) { + char *name; + if (info->magic != PARTITION_MAGIC) { break; @@ -842,8 +844,8 @@ int esp32s3_partition_init(void) mtd_priv->mtd.ioctl = esp32s3_part_ioctl; mtd_priv->mtd.read = esp32s3_part_read; mtd_priv->mtd.write = esp32s3_part_write; - mtd_priv->mtd.name = strdup(label); - if (!mtd_priv->mtd.name) + mtd_priv->mtd.name = name = strdup(label); + if (!name) { ferr("ERROR: Failed to allocate MTD name\n"); kmm_free(mtd_priv); @@ -857,7 +859,7 @@ int esp32s3_partition_init(void) if (!mtd_priv->part_mtd) { ferr("ERROR: Failed to create MTD partition\n"); - lib_free(mtd_priv->mtd.name); + lib_free(name); kmm_free(mtd_priv); ret = -ENOSPC; goto errout_with_mtd; @@ -867,7 +869,7 @@ int esp32s3_partition_init(void) if (ret < 0) { ferr("ERROR: Failed to register MTD @ %s\n", path); - lib_free(mtd_priv->mtd.name); + lib_free(name); kmm_free(mtd_priv); goto errout_with_mtd; }