diff --git a/nshlib/nsh.h b/nshlib/nsh.h
index 3573f67a8..acbdeb8a4 100644
--- a/nshlib/nsh.h
+++ b/nshlib/nsh.h
@@ -684,12 +684,13 @@
 #  undef NSH_HAVE_TRIMDIR
 #endif
 
-/* nsh_catfile used by cat, ifconfig, ifup/down, df, free, and mount */
+/* nsh_catfile used by cat, ifconfig, ifup/down, df, free, and mount (with
+ * no arguments).
+ */
 
 #if !defined(CONFIG_NSH_DISABLE_CAT) && !defined(CONFIG_NSH_DISABLE_IFCONFIG) && \
     !defined(CONFIG_NSH_DISABLE_IFUPDOWN) && !defined(CONFIG_NSH_DISABLE_DF) && \
-    !defined(CONFIG_NSH_DISABLE_FREE) && \
-    (!defined(CONFIG_NSH_DISABLE_MOUNT) || !defined(HAVE_MOUNT_LIST))
+    !defined(CONFIG_NSH_DISABLE_FREE) && !defined(HAVE_MOUNT_LIST)
 #  undef NSH_HAVE_CATFILE
 #endif
 
diff --git a/nshlib/nsh_mmcmds.c b/nshlib/nsh_mmcmds.c
index 75bdde8cf..235072c1d 100644
--- a/nshlib/nsh_mmcmds.c
+++ b/nshlib/nsh_mmcmds.c
@@ -42,6 +42,8 @@
 #include "nsh.h"
 #include "nsh_console.h"
 
+#if !defined(CONFIG_NSH_DISABLE_FREE) && defined(NSH_HAVE_CATFILE)
+
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -50,9 +52,9 @@
  * Name: cmd_free
  ****************************************************************************/
 
-#if !defined(CONFIG_NSH_DISABLE_FREE) && defined(NSH_HAVE_CATFILE)
 int cmd_free(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
 {
   return nsh_catfile(vtbl, argv[0], CONFIG_NSH_PROC_MOUNTPOINT "/meminfo");
 }
-#endif /* !CONFIG_NSH_DISABLE_FREE */
+
+#endif /* !CONFIG_NSH_DISABLE_FREE && NSH_HAVE_CATFILE */