summaryrefslogtreecommitdiff
path: root/nuttx/fs/smartfs
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-11-25 13:46:14 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-11-25 13:46:14 -0600
commitf28eff61aeb62c867249c8cb21162dbd3c60cc37 (patch)
treec1c8b6d68fb43d3ae59c3eb589e6a4c44acdcd57 /nuttx/fs/smartfs
parent3b3fcf2bfa6015d890d42b5a528f7fe7476632f7 (diff)
downloadnuttx-f28eff61aeb62c867249c8cb21162dbd3c60cc37.tar.gz
nuttx-f28eff61aeb62c867249c8cb21162dbd3c60cc37.tar.bz2
nuttx-f28eff61aeb62c867249c8cb21162dbd3c60cc37.zip
More fixes to problems noted by cppcheck. Some are kind of risky; some are real bugs.
Diffstat (limited to 'nuttx/fs/smartfs')
-rw-r--r--nuttx/fs/smartfs/smartfs_procfs.c10
-rw-r--r--nuttx/fs/smartfs/smartfs_smart.c24
2 files changed, 20 insertions, 14 deletions
diff --git a/nuttx/fs/smartfs/smartfs_procfs.c b/nuttx/fs/smartfs/smartfs_procfs.c
index 2b56f366d..e74d65944 100644
--- a/nuttx/fs/smartfs/smartfs_procfs.c
+++ b/nuttx/fs/smartfs/smartfs_procfs.c
@@ -709,7 +709,9 @@ static size_t smartfs_status_read(FAR struct file *filep, FAR char *buffer,
FAR struct smartfs_file_s *priv;
int ret;
size_t len;
+#if 0 /* Not used */
int utilization;
+#endif
priv = (FAR struct smartfs_file_s *) filep->f_priv;
@@ -729,6 +731,7 @@ static size_t smartfs_status_read(FAR struct file *filep, FAR char *buffer,
if (ret == OK)
{
+#if 0 /* Not used */
/* Calculate the sector utilization percentage */
if (procfs_data.blockerases == 0)
@@ -741,6 +744,7 @@ static size_t smartfs_status_read(FAR struct file *filep, FAR char *buffer,
procfs_data.unusedsectors) / (procfs_data.blockerases *
procfs_data.sectorsperblk);
}
+#endif
/* Format and return data in the buffer */
@@ -756,8 +760,10 @@ static size_t smartfs_status_read(FAR struct file *filep, FAR char *buffer,
procfs_data.formatsector, procfs_data.dirsector,
procfs_data.freesectors, procfs_data.releasesectors,
procfs_data.sectorsperblk);
- //procfs_data.unusedsectors, procfs_data.blockerases,
- //procfs_data.sectorsperblk, utilization);
+#if 0 /* Not used */
+ procfs_data.unusedsectors, procfs_data.blockerases,
+ procfs_data.sectorsperblk, utilization);
+#endif
}
/* Indicate we have already provided all the data */
diff --git a/nuttx/fs/smartfs/smartfs_smart.c b/nuttx/fs/smartfs/smartfs_smart.c
index bcbda7de8..0b9a373b1 100644
--- a/nuttx/fs/smartfs/smartfs_smart.c
+++ b/nuttx/fs/smartfs/smartfs_smart.c
@@ -1441,7 +1441,7 @@ static int smartfs_unbind(void *handle, FAR struct inode **blkdriver)
static int smartfs_statfs(struct inode *mountpt, struct statfs *buf)
{
struct smartfs_mountpt_s *fs;
- int ret = OK;
+ int ret;
/* Sanity checks */
@@ -1483,11 +1483,11 @@ static int smartfs_statfs(struct inode *mountpt, struct statfs *buf)
static int smartfs_unlink(struct inode *mountpt, const char *relpath)
{
- struct smartfs_mountpt_s *fs;
- int ret = OK;
- struct smartfs_entry_s entry;
- const char *filename;
- uint16_t parentdirsector;
+ struct smartfs_mountpt_s *fs;
+ int ret;
+ struct smartfs_entry_s entry;
+ const char *filename;
+ uint16_t parentdirsector;
/* Sanity checks */
@@ -1627,11 +1627,11 @@ errout_with_semaphore:
int smartfs_rmdir(struct inode *mountpt, const char *relpath)
{
- struct smartfs_mountpt_s *fs;
- int ret = OK;
- struct smartfs_entry_s entry;
- const char *filename;
- uint16_t parentdirsector;
+ struct smartfs_mountpt_s *fs;
+ int ret;
+ struct smartfs_entry_s entry;
+ const char *filename;
+ uint16_t parentdirsector;
/* Sanity checks */
@@ -1916,7 +1916,7 @@ static int smartfs_stat(struct inode *mountpt, const char *relpath, struct stat
{
struct smartfs_mountpt_s *fs;
struct smartfs_entry_s entry;
- int ret = -ENOENT;
+ int ret;
uint16_t parentdirsector;
const char *filename;