Merge pull request #3806 from BernardXiong/code_cleanup
[DFS] clean the unnecessary checking
This commit is contained in:
commit
dd687ff084
|
@ -129,7 +129,7 @@ const char *dfs_filesystem_get_mounted_path(struct rt_device *device)
|
||||||
for (iter = &filesystem_table[0];
|
for (iter = &filesystem_table[0];
|
||||||
iter < &filesystem_table[DFS_FILESYSTEMS_MAX]; iter++)
|
iter < &filesystem_table[DFS_FILESYSTEMS_MAX]; iter++)
|
||||||
{
|
{
|
||||||
/* fint the mounted device */
|
/* find the mounted device */
|
||||||
if (iter->ops == NULL) continue;
|
if (iter->ops == NULL) continue;
|
||||||
else if (iter->dev_id == device)
|
else if (iter->dev_id == device)
|
||||||
{
|
{
|
||||||
|
@ -321,7 +321,7 @@ int dfs_mount(const char *device_name,
|
||||||
if (rt_device_open(fs->dev_id,
|
if (rt_device_open(fs->dev_id,
|
||||||
RT_DEVICE_OFLAG_RDWR) != RT_EOK)
|
RT_DEVICE_OFLAG_RDWR) != RT_EOK)
|
||||||
{
|
{
|
||||||
/* The underlaying device has error, clear the entry. */
|
/* The underlying device has error, clear the entry. */
|
||||||
dfs_lock();
|
dfs_lock();
|
||||||
memset(fs, 0, sizeof(struct dfs_filesystem));
|
memset(fs, 0, sizeof(struct dfs_filesystem));
|
||||||
|
|
||||||
|
@ -568,8 +568,7 @@ int dfs_unmount_device(rt_device_t dev)
|
||||||
iter < &filesystem_table[DFS_FILESYSTEMS_MAX]; iter++)
|
iter < &filesystem_table[DFS_FILESYSTEMS_MAX]; iter++)
|
||||||
{
|
{
|
||||||
/* check if the PATH is mounted */
|
/* check if the PATH is mounted */
|
||||||
if ((iter->dev_id->parent.name != NULL)
|
if (strcmp(iter->dev_id->parent.name, dev->parent.name) == 0)
|
||||||
&& (strcmp(iter->dev_id->parent.name, dev->parent.name) == 0))
|
|
||||||
{
|
{
|
||||||
fs = iter;
|
fs = iter;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue