!613 解决sd卡读写操作时对卡进行热插拔后,disk资源未释放问题

Merge pull request !613 from 董逸群/OpenHarmony_1.0.1_release
This commit is contained in:
openharmony_ci 2021-09-09 06:38:33 +00:00 committed by Gitee
commit a8513ae614
1 changed files with 3 additions and 3 deletions

View File

@ -1279,20 +1279,20 @@ static INT32 DiskDeinit(los_disk *disk)
#endif
disk->dev = NULL;
DISK_UNLOCK(&disk->disk_mutex);
(VOID)unregister_blockdriver(disk->disk_name);
if (disk->disk_name != NULL) {
LOS_MemFree(m_aucSysMem0, disk->disk_name);
disk->disk_name = NULL;
}
DISK_UNLOCK(&disk->disk_mutex);
disk->disk_status = STAT_UNUSED;
ret = pthread_mutex_destroy(&disk->disk_mutex);
if (ret != 0) {
PRINT_ERR("%s %d, mutex destroy failed, ret = %d\n", __FUNCTION__, __LINE__, ret);
return -EFAULT;
}
disk->disk_status = STAT_UNUSED;
return ENOERR;
}