diff --git a/source/ff.c b/source/ff.c index a378cf1..fca4371 100644 --- a/source/ff.c +++ b/source/ff.c @@ -3882,6 +3882,9 @@ FRESULT f_open ( #endif } } +#if FF_FS_LOCK != 0 + if (res != FR_OK) dec_lock(fp->obj.lockid); /* Decrement file open counter if seek failed */ +#endif } #endif }