summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-11-25 14:10:35 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-11-25 14:10:35 -0600
commite814f226d6aa6c1700706bb8db9c190b8244eee5 (patch)
tree43d0dfba6c451cf16eef42251d776dc4e14cbec6
parentf28eff61aeb62c867249c8cb21162dbd3c60cc37 (diff)
downloadnuttx-e814f226d6aa6c1700706bb8db9c190b8244eee5.tar.gz
nuttx-e814f226d6aa6c1700706bb8db9c190b8244eee5.tar.bz2
nuttx-e814f226d6aa6c1700706bb8db9c190b8244eee5.zip
More fixes to problems noted by cppcheck. Some are kind of risky; some are real bugs.
-rw-r--r--nuttx/fs/nxffs/nxffs_stat.c2
-rw-r--r--nuttx/libc/syslog/lib_syslog.c2
-rw-r--r--nuttx/libc/unistd/lib_execl.c1
-rw-r--r--nuttx/net/iob/iob_trimtail.c6
-rw-r--r--nuttx/net/route/netdev_router.c1
-rw-r--r--nuttx/sched/init/os_start.c2
-rw-r--r--nuttx/sched/sched/sched_timerexpiration.c5
-rw-r--r--nuttx/sched/wdog/wd_start.c2
-rw-r--r--nuttx/sched/wqueue/kwork_inherit.c2
9 files changed, 9 insertions, 14 deletions
diff --git a/nuttx/fs/nxffs/nxffs_stat.c b/nuttx/fs/nxffs/nxffs_stat.c
index 656da395a..2a5b61044 100644
--- a/nuttx/fs/nxffs/nxffs_stat.c
+++ b/nuttx/fs/nxffs/nxffs_stat.c
@@ -151,7 +151,6 @@ int nxffs_stat(FAR struct inode *mountpt, FAR const char *relpath,
memset(buf, 0, sizeof(struct stat));
buf->st_blksize = volume->geo.blocksize;
- buf->st_blocks = entry.datlen / (volume->geo.blocksize - SIZEOF_NXFFS_BLOCK_HDR);
/* The requested directory must be the volume-relative "root" directory */
@@ -166,6 +165,7 @@ int nxffs_stat(FAR struct inode *mountpt, FAR const char *relpath,
goto errout_with_semaphore;
}
+ buf->st_blocks = entry.datlen / (volume->geo.blocksize - SIZEOF_NXFFS_BLOCK_HDR);
buf->st_mode = S_IFREG|S_IXOTH|S_IXGRP|S_IXUSR;
buf->st_size = entry.datlen;
buf->st_atime = entry.utc;
diff --git a/nuttx/libc/syslog/lib_syslog.c b/nuttx/libc/syslog/lib_syslog.c
index 636401046..4ec544329 100644
--- a/nuttx/libc/syslog/lib_syslog.c
+++ b/nuttx/libc/syslog/lib_syslog.c
@@ -108,7 +108,7 @@ static inline int vsyslog_internal(FAR const char *fmt, va_list ap)
/* Get the current time */
- ret = clock_systimespec(&ts);
+ (void)clock_systimespec(&ts);
#endif
#if defined(CONFIG_SYSLOG)
diff --git a/nuttx/libc/unistd/lib_execl.c b/nuttx/libc/unistd/lib_execl.c
index ba5551066..a6b908234 100644
--- a/nuttx/libc/unistd/lib_execl.c
+++ b/nuttx/libc/unistd/lib_execl.c
@@ -146,6 +146,7 @@ int execl(FAR const char *path, ...)
if (++nargs > MAX_EXECL_ARGS)
{
set_errno(E2BIG);
+ va_end(ap);
return ERROR;
}
}
diff --git a/nuttx/net/iob/iob_trimtail.c b/nuttx/net/iob/iob_trimtail.c
index c436550a8..36eebb26f 100644
--- a/nuttx/net/iob/iob_trimtail.c
+++ b/nuttx/net/iob/iob_trimtail.c
@@ -86,7 +86,6 @@ FAR struct iob_s *iob_trimtail(FAR struct iob_s *iob, unsigned int trimlen)
FAR struct iob_s *entry;
FAR struct iob_s *penultimate;
FAR struct iob_s *last;
- unsigned int iosize;
int len;
nlldbg("iob=%p pktlen=%d trimlen=%d\n", iob, iob->io_pktlen, trimlen);
@@ -105,14 +104,9 @@ FAR struct iob_s *iob_trimtail(FAR struct iob_s *iob, unsigned int trimlen)
penultimate = NULL;
last = NULL;
- iosize = 0;
for (entry = iob; entry; entry = entry->io_flink)
{
- /* Accumulate the total size of all buffers in the list */
-
- iosize += entry->io_len;
-
/* Remember the last and the next to the last in the chain */
penultimate = last;
diff --git a/nuttx/net/route/netdev_router.c b/nuttx/net/route/netdev_router.c
index d49c1e4d0..67e49c67f 100644
--- a/nuttx/net/route/netdev_router.c
+++ b/nuttx/net/route/netdev_router.c
@@ -163,7 +163,6 @@ void netdev_router(FAR struct net_driver_s *dev, net_ipaddr_t target,
#else
net_ipaddr_copy(*router, match.target);
#endif
- ret = OK;
}
else
{
diff --git a/nuttx/sched/init/os_start.c b/nuttx/sched/init/os_start.c
index f48bea318..561e79b9b 100644
--- a/nuttx/sched/init/os_start.c
+++ b/nuttx/sched/init/os_start.c
@@ -341,6 +341,7 @@ void os_start(void)
sem_initialize();
+#if defined(MM_KERNEL_USRHEAP_INIT) || defined(CONFIG_MM_KERNEL_HEAP) || defined(CONFIG_MM_PGALLOC)
/* Initialize the memory manager */
{
@@ -375,6 +376,7 @@ void os_start(void)
mm_pginitialize(heap_start, heap_size);
#endif
}
+#endif
#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS)
/* Initialize tasking data structures */
diff --git a/nuttx/sched/sched/sched_timerexpiration.c b/nuttx/sched/sched/sched_timerexpiration.c
index 2b1117fec..d56827ed1 100644
--- a/nuttx/sched/sched/sched_timerexpiration.c
+++ b/nuttx/sched/sched/sched_timerexpiration.c
@@ -467,12 +467,9 @@ static void sched_timer_start(unsigned int ticks)
ret = up_timer_start(&ts);
#endif
- /* [Re-]start the interval timer */
-
- ret = up_timer_start(&ts);
if (ret < 0)
{
- slldbg("ERROR: up_timer_start failed: %d\n");
+ slldbg("ERROR: up_timer_start/up_alarm_start failed: %d\n");
UNUSED(ret);
}
}
diff --git a/nuttx/sched/wdog/wd_start.c b/nuttx/sched/wdog/wd_start.c
index 25d829409..6faf0e6df 100644
--- a/nuttx/sched/wdog/wd_start.c
+++ b/nuttx/sched/wdog/wd_start.c
@@ -452,7 +452,7 @@ unsigned int wd_timer(int ticks)
/* There are. Decrement the lag counter */
wdog->lag -= decr;
- ticks -= ticks;
+ ticks -= decr;
/* Check if the watchdog at the head of the list is ready to run */
diff --git a/nuttx/sched/wqueue/kwork_inherit.c b/nuttx/sched/wqueue/kwork_inherit.c
index e4df5e1f4..c169d877c 100644
--- a/nuttx/sched/wqueue/kwork_inherit.c
+++ b/nuttx/sched/wqueue/kwork_inherit.c
@@ -176,9 +176,11 @@ static void lpwork_boostworker(pid_t wpid, uint8_t reqprio)
static void lpwork_restoreworker(pid_t wpid, uint8_t reqprio)
{
FAR struct tcb_s *wtcb;
+#if CONFIG_SEM_NNESTPRIO > 0
uint8_t wpriority;
int index;
int selected;
+#endif
/* Get the TCB of the low priority worker thread from the process ID. */