summaryrefslogtreecommitdiff
path: root/nuttx/fs/smartfs
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-02-10 18:08:49 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-02-10 18:08:49 -0600
commit6db1f6f71c8867cbae3a2c5597b01f321064a370 (patch)
treebd0b760c6467a0b528b7b29480f944c99c186693 /nuttx/fs/smartfs
parent07d355e8f77afbc04ea94089071b0154e747acec (diff)
downloadnuttx-6db1f6f71c8867cbae3a2c5597b01f321064a370.tar.gz
nuttx-6db1f6f71c8867cbae3a2c5597b01f321064a370.tar.bz2
nuttx-6db1f6f71c8867cbae3a2c5597b01f321064a370.zip
Many changes to reduce complaints from CppCheck. Several latent bugs fixes, but probably some new typos introduced
Diffstat (limited to 'nuttx/fs/smartfs')
-rw-r--r--nuttx/fs/smartfs/smartfs_procfs.c5
-rw-r--r--nuttx/fs/smartfs/smartfs_smart.c4
-rw-r--r--nuttx/fs/smartfs/smartfs_utils.c3
3 files changed, 4 insertions, 8 deletions
diff --git a/nuttx/fs/smartfs/smartfs_procfs.c b/nuttx/fs/smartfs/smartfs_procfs.c
index 64f7101d4..f1c75c365 100644
--- a/nuttx/fs/smartfs/smartfs_procfs.c
+++ b/nuttx/fs/smartfs/smartfs_procfs.c
@@ -435,14 +435,11 @@ static int smartfs_rewinddir(struct fs_dirent_s *dir)
static int smartfs_stat(const char *relpath, struct stat *buf)
{
- int ret = -ENOENT;
-
/* TODO: Decide if the relpath is valid and if it is a file
* or a directory and set it's permissions.
*/
buf->st_mode = S_IFDIR|S_IROTH|S_IRGRP|S_IRUSR;
- ret = OK;
/* File/directory size, access block size */
@@ -450,7 +447,7 @@ static int smartfs_stat(const char *relpath, struct stat *buf)
buf->st_blksize = 0;
buf->st_blocks = 0;
- return ret;
+ return OK;
}
/****************************************************************************
diff --git a/nuttx/fs/smartfs/smartfs_smart.c b/nuttx/fs/smartfs/smartfs_smart.c
index 7264b3f64..50018a443 100644
--- a/nuttx/fs/smartfs/smartfs_smart.c
+++ b/nuttx/fs/smartfs/smartfs_smart.c
@@ -192,7 +192,7 @@ static int smartfs_open(FAR struct file *filep, const char *relpath,
sf = (struct smartfs_ofile_s *) kmalloc(sizeof *sf);
if (sf == NULL)
{
- ret = ENOMEM;
+ ret = -ENOMEM;
goto errout_with_semaphore;
}
@@ -213,7 +213,7 @@ static int smartfs_open(FAR struct file *filep, const char *relpath,
{
/* Can't open a dir as a file! */
- ret = EISDIR;
+ ret = -EISDIR;
goto errout_with_buffer;
}
diff --git a/nuttx/fs/smartfs/smartfs_utils.c b/nuttx/fs/smartfs/smartfs_utils.c
index 30813a44b..3c41ce524 100644
--- a/nuttx/fs/smartfs/smartfs_utils.c
+++ b/nuttx/fs/smartfs/smartfs_utils.c
@@ -854,11 +854,10 @@ int smartfs_createentry(struct smartfs_mountpt_s *fs,
goto errout;
}
- nextsector = ret;
+ nextsector = (uint16_t) ret;
/* Set the newly allocated sector's type (file or dir) */
- nextsector = (uint16_t) ret;
if ((type & SMARTFS_DIRENT_TYPE) == SMARTFS_DIRENT_TYPE_DIR)
{
chainheader->type = SMARTFS_SECTOR_TYPE_DIR;