提交 ff303aa8 编写于 作者: O openharmony_ci 提交者: Gitee

!31 fix: 修复FATFS中的错误

Merge pull request !31 from Far/master
...@@ -3424,6 +3424,9 @@ FRESULT f_open ( ...@@ -3424,6 +3424,9 @@ FRESULT f_open (
fp->buf = (BYTE*) ff_memalloc(SS(fs)); /* Init sector buffer */ fp->buf = (BYTE*) ff_memalloc(SS(fs)); /* Init sector buffer */
if (fp->buf == NULL) { if (fp->buf == NULL) {
res = FR_NOT_ENOUGH_CORE; res = FR_NOT_ENOUGH_CORE;
#if FF_FS_LOCK != 0
dec_lock(fp->obj.lockid);
#endif
#if FF_FS_REENTRANT #if FF_FS_REENTRANT
LEAVE_FF(fs_bak, res); LEAVE_FF(fs_bak, res);
#else #else
...@@ -3484,11 +3487,11 @@ FRESULT f_open ( ...@@ -3484,11 +3487,11 @@ FRESULT f_open (
clst = get_fat(&fp->obj, clst); clst = get_fat(&fp->obj, clst);
} }
} }
}
if (res != FR_OK) { #endif
/* If the chain is occupied, Recycle the file lock ,pass out an error*/ #if FF_FS_LOCK != 0
dec_lock(fp->obj.lockid); if (res != FR_OK) {
} dec_lock(fp->obj.lockid); /* Ivalid lockid will be ignored */
} }
#endif #endif
FREE_NAMBUF(); FREE_NAMBUF();
...@@ -5597,7 +5600,7 @@ FRESULT f_mkfs ( ...@@ -5597,7 +5600,7 @@ FRESULT f_mkfs (
UINT n_fat, n_root, i; /* Index, Number of FATs and Number of roor dir entries */ UINT n_fat, n_root, i; /* Index, Number of FATs and Number of roor dir entries */
int vol; int vol;
DSTATUS ds; DSTATUS ds;
FRESULT fr; FRESULT fr = FR_OK;
#if FF_MULTI_PARTITION #if FF_MULTI_PARTITION
int extended_br; int extended_br;
int extended_pos = -1; int extended_pos = -1;
...@@ -6362,6 +6365,7 @@ FRESULT f_fdisk ( ...@@ -6362,6 +6365,7 @@ FRESULT f_fdisk (
while (szt[i] != 0 && i < 4) { while (szt[i] != 0 && i < 4) {
ptbl[i] = szt[i]; ptbl[i] = szt[i];
i++;
} }
LEAVE_MKFS(create_partition(pdrv, ptbl, 0x07, buf)); LEAVE_MKFS(create_partition(pdrv, ptbl, 0x07, buf));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册