summaryrefslogtreecommitdiff
path: root/env/fat.c
diff options
context:
space:
mode:
Diffstat (limited to 'env/fat.c')
-rw-r--r--env/fat.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/env/fat.c b/env/fat.c
index b04b1d9c315..1ad301eaaff 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -41,14 +41,12 @@ __weak const char *env_fat_get_intf(void)
__weak char *env_fat_get_dev_part(void)
{
#ifdef CONFIG_MMC
- static char *part_str;
-
- if (!part_str) {
- part_str = CONFIG_ENV_FAT_DEVICE_AND_PART;
- if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc") && part_str[0] == ':') {
- part_str = "0" CONFIG_ENV_FAT_DEVICE_AND_PART;
- part_str[0] += mmc_get_env_dev();
- }
+ /* reserve one more char for the manipulation below */
+ static char part_str[] = CONFIG_ENV_FAT_DEVICE_AND_PART "\0";
+
+ if (!strcmp(CONFIG_ENV_FAT_INTERFACE, "mmc") && part_str[0] == ':') {
+ part_str[0] = '0' + mmc_get_env_dev();
+ strcpy(&part_str[1], CONFIG_ENV_FAT_DEVICE_AND_PART);
}
return part_str;