diff --git a/fs/mount/fs_mount.c b/fs/mount/fs_mount.c index 39bb8da53b9..b0c7d2eb543 100644 --- a/fs/mount/fs_mount.c +++ b/fs/mount/fs_mount.c @@ -266,11 +266,9 @@ int nx_mount(FAR const char *source, FAR const char *target, FAR const void *data) { #if defined(BDFS_SUPPORT) || defined(MDFS_SUPPORT) || defined(NODFS_SUPPORT) -#if defined(BDFS_SUPPORT) || defined(MDFS_SUPPORT) FAR struct inode *drvr_inode = NULL; -#endif FAR struct inode *mountpt_inode; - FAR const struct mountpt_operations *mops; + FAR const struct mountpt_operations *mops = NULL; #ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS struct inode_search_s desc; #endif @@ -283,13 +281,14 @@ int nx_mount(FAR const char *source, FAR const char *target, /* Find the specified filesystem. Try the block driver filesystems first */ -#ifdef BDFS_SUPPORT if (source != NULL && find_blockdriver(source, mountflags, &drvr_inode) >= 0) { /* Find the block based file system */ +#ifdef BDFS_SUPPORT mops = mount_findfs(g_bdfsmap, filesystemtype); +#endif /* BDFS_SUPPORT */ if (mops == NULL) { ferr("ERROR: Failed to find block based file system %s\n", @@ -299,14 +298,14 @@ int nx_mount(FAR const char *source, FAR const char *target, goto errout_with_inode; } } - else -#endif /* BDFS_SUPPORT */ -#ifdef MDFS_SUPPORT - if (source != NULL && (ret = find_mtddriver(source, &drvr_inode)) >= 0) + else if (source != NULL && + (ret = find_mtddriver(source, &drvr_inode)) >= 0) { /* Find the MTD based file system */ +#ifdef MDFS_SUPPORT mops = mount_findfs(g_mdfsmap, filesystemtype); +#endif /* MDFS_SUPPORT */ if (mops == NULL) { ferr("ERROR: Failed to find MTD based file system %s\n", @@ -317,7 +316,6 @@ int nx_mount(FAR const char *source, FAR const char *target, } } else -#endif /* MDFS_SUPPORT */ #ifdef NODFS_SUPPORT if ((mops = mount_findfs(g_nonbdfsmap, filesystemtype)) != NULL) {