From 095cc0fc0186741dca073ba69c655b23e35dde8c Mon Sep 17 00:00:00 2001 From: Christopher Williams Date: Wed, 11 Mar 2015 10:29:46 -0700 Subject: [PATCH] R0.11 with patch 1 March 9, 2015 At the thread-safe configuration (_FS_REENTRANT == 1), an unexpected operation to the volume can result a wrong volume lock. For example, f_open() ==> media change ==> f_close(), in this case the volume gets left locked and following function calls to the volume will be locked out until a forced initialization of the volume by f_mount(). To solve this problem, apply this patch to the ff.c. --- src/ff.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ff.c b/src/ff.c index e4199c3..0891ec2 100644 --- a/src/ff.c +++ b/src/ff.c @@ -2329,14 +2329,11 @@ FRESULT validate ( /* FR_OK(0): The object is valid, !=0: Invalid */ FIL *fil = (FIL*)obj; /* Assuming offset of .fs and .id in the FIL/DIR structure is identical */ - if (!fil || !fil->fs || !fil->fs->fs_type || fil->fs->id != fil->id) + if (!fil || !fil->fs || !fil->fs->fs_type || fil->fs->id != fil->id || (disk_status(fil->fs->drv) & STA_NOINIT)) return FR_INVALID_OBJECT; ENTER_FF(fil->fs); /* Lock file system */ - if (disk_status(fil->fs->drv) & STA_NOINIT) - return FR_NOT_READY; - return FR_OK; }