Skip to content

Commit

Permalink
esp32s3_partition.c: Appease a compiler warning (-Wdiscarded-qualifiers)
Browse files Browse the repository at this point in the history
  • Loading branch information
yamt authored and xiaoxiang781216 committed Nov 20, 2024
1 parent 032b2bc commit 788f8fc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions arch/xtensa/src/esp32s3/esp32s3_partition.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 788f8fc

Please sign in to comment.