Silence some warnings

This commit is contained in:
Paul A. Patience
2016-05-26 12:01:15 -04:00
parent b36d125e33
commit f8f7b7582c
12 changed files with 100 additions and 73 deletions
+7 -4
View File
@@ -65,15 +65,18 @@ static int devnull_poll(FAR struct file *filep, FAR struct pollfd *fds,
static const struct file_operations devnull_fops = static const struct file_operations devnull_fops =
{ {
0, /* open */ NULL, /* open */
0, /* close */ NULL, /* close */
devnull_read, /* read */ devnull_read, /* read */
devnull_write, /* write */ devnull_write, /* write */
0, /* seek */ NULL, /* seek */
0 /* ioctl */ NULL /* ioctl */
#ifndef CONFIG_DISABLE_POLL #ifndef CONFIG_DISABLE_POLL
, devnull_poll /* poll */ , devnull_poll /* poll */
#endif #endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif
}; };
/**************************************************************************** /****************************************************************************
+7 -4
View File
@@ -65,15 +65,18 @@ static int devzero_poll(FAR struct file *filep, FAR struct pollfd *fds,
static const struct file_operations devzero_fops = static const struct file_operations devzero_fops =
{ {
0, /* open */ NULL, /* open */
0, /* close */ NULL, /* close */
devzero_read, /* read */ devzero_read, /* read */
devzero_write, /* write */ devzero_write, /* write */
0, /* seek */ NULL, /* seek */
0 /* ioctl */ NULL /* ioctl */
#ifndef CONFIG_DISABLE_POLL #ifndef CONFIG_DISABLE_POLL
, devzero_poll /* poll */ , devzero_poll /* poll */
#endif #endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif
}; };
/**************************************************************************** /****************************************************************************
+7 -4
View File
@@ -140,12 +140,15 @@ static const struct file_operations userled_fops =
{ {
userled_open, /* open */ userled_open, /* open */
userled_close, /* close */ userled_close, /* close */
0, /* read */ NULL, /* read */
userled_write, /* write */ userled_write, /* write */
0, /* seek */ NULL, /* seek */
userled_ioctl /* ioctl */ userled_ioctl /* ioctl */
#ifndef CONFIG_DISABLE_POLL #ifndef CONFIG_DISABLE_POLL
, 0 /* poll */ , NULL /* poll */
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif #endif
}; };
@@ -441,7 +444,7 @@ static int userled_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
/* Check that a valid LED is being set */ /* Check that a valid LED is being set */
if (led < 8 * sizeof(userled_set_t) && if ((size_t)led < 8 * sizeof(userled_set_t) &&
(priv->lu_supported & (1 << led)) != 0) (priv->lu_supported & (1 << led)) != 0)
{ {
/* Update the LED state */ /* Update the LED state */
+9 -6
View File
@@ -107,16 +107,19 @@ static int loop_geometry(FAR struct inode *inode,
static const struct block_operations g_bops = static const struct block_operations g_bops =
{ {
loop_open, /* open */ loop_open, /* open */
loop_close, /* close */ loop_close, /* close */
loop_read, /* read */ loop_read, /* read */
#ifdef CONFIG_FS_WRITABLE #ifdef CONFIG_FS_WRITABLE
loop_write, /* write */ loop_write, /* write */
#else #else
NULL, /* write */ NULL, /* write */
#endif #endif
loop_geometry, /* geometry */ loop_geometry, /* geometry */
NULL /* ioctl */ NULL /* ioctl */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif
}; };
/**************************************************************************** /****************************************************************************
+35 -32
View File
@@ -92,7 +92,7 @@ static void pipecommon_semtake(sem_t *sem);
* Name: pipecommon_semtake * Name: pipecommon_semtake
****************************************************************************/ ****************************************************************************/
static void pipecommon_semtake(sem_t *sem) static void pipecommon_semtake(FAR sem_t *sem)
{ {
while (sem_wait(sem) != 0) while (sem_wait(sem) != 0)
{ {
@@ -109,7 +109,8 @@ static void pipecommon_semtake(sem_t *sem)
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_DISABLE_POLL #ifndef CONFIG_DISABLE_POLL
static void pipecommon_pollnotify(FAR struct pipe_dev_s *dev, pollevent_t eventset) static void pipecommon_pollnotify(FAR struct pipe_dev_s *dev,
pollevent_t eventset)
{ {
int i; int i;
@@ -120,7 +121,7 @@ static void pipecommon_pollnotify(FAR struct pipe_dev_s *dev, pollevent_t events
for (i = 0; i < CONFIG_DEV_PIPE_NPOLLWAITERS; i++) for (i = 0; i < CONFIG_DEV_PIPE_NPOLLWAITERS; i++)
{ {
struct pollfd *fds = dev->d_fds[i]; FAR struct pollfd *fds = dev->d_fds[i];
if (fds) if (fds)
{ {
fds->revents |= eventset & (fds->events | POLLERR | POLLHUP); fds->revents |= eventset & (fds->events | POLLERR | POLLHUP);
@@ -158,7 +159,7 @@ FAR struct pipe_dev_s *pipecommon_allocdev(void)
/* Allocate a private structure to manage the pipe */ /* Allocate a private structure to manage the pipe */
dev = (struct pipe_dev_s *)kmm_malloc(sizeof(struct pipe_dev_s)); dev = (FAR struct pipe_dev_s *)kmm_malloc(sizeof(struct pipe_dev_s));
if (dev) if (dev)
{ {
/* Initialize the private structure */ /* Initialize the private structure */
@@ -190,10 +191,10 @@ void pipecommon_freedev(FAR struct pipe_dev_s *dev)
int pipecommon_open(FAR struct file *filep) int pipecommon_open(FAR struct file *filep)
{ {
FAR struct inode *inode = filep->f_inode; FAR struct inode *inode = filep->f_inode;
FAR struct pipe_dev_s *dev = inode->i_private; FAR struct pipe_dev_s *dev = inode->i_private;
int sval; int sval;
int ret; int ret;
DEBUGASSERT(dev != NULL); DEBUGASSERT(dev != NULL);
@@ -302,9 +303,9 @@ int pipecommon_open(FAR struct file *filep)
int pipecommon_close(FAR struct file *filep) int pipecommon_close(FAR struct file *filep)
{ {
struct inode *inode = filep->f_inode; FAR struct inode *inode = filep->f_inode;
struct pipe_dev_s *dev = inode->i_private; FAR struct pipe_dev_s *dev = inode->i_private;
int sval; int sval;
DEBUGASSERT(dev && dev->d_refs > 0); DEBUGASSERT(dev && dev->d_refs > 0);
@@ -408,14 +409,14 @@ int pipecommon_close(FAR struct file *filep)
ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len) ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len)
{ {
struct inode *inode = filep->f_inode; FAR struct inode *inode = filep->f_inode;
struct pipe_dev_s *dev = inode->i_private; FAR struct pipe_dev_s *dev = inode->i_private;
#ifdef CONFIG_DEV_PIPEDUMP #ifdef CONFIG_DEV_PIPEDUMP
FAR uint8_t *start = (FAR uint8_t *)buffer; FAR uint8_t *start = (FAR uint8_t *)buffer;
#endif #endif
ssize_t nread = 0; ssize_t nread = 0;
int sval; int sval;
int ret; int ret;
DEBUGASSERT(dev); DEBUGASSERT(dev);
@@ -467,7 +468,7 @@ ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len)
/* Then return whatever is available in the pipe (which is at least one byte) */ /* Then return whatever is available in the pipe (which is at least one byte) */
nread = 0; nread = 0;
while (nread < len && dev->d_wrndx != dev->d_rdndx) while ((size_t)nread < len && dev->d_wrndx != dev->d_rdndx)
{ {
*buffer++ = dev->d_buffer[dev->d_rdndx]; *buffer++ = dev->d_buffer[dev->d_rdndx];
if (++dev->d_rdndx >= CONFIG_DEV_PIPE_SIZE) if (++dev->d_rdndx >= CONFIG_DEV_PIPE_SIZE)
@@ -497,14 +498,15 @@ ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len)
* Name: pipecommon_write * Name: pipecommon_write
****************************************************************************/ ****************************************************************************/
ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer, size_t len) ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer,
size_t len)
{ {
struct inode *inode = filep->f_inode; FAR struct inode *inode = filep->f_inode;
struct pipe_dev_s *dev = inode->i_private; FAR struct pipe_dev_s *dev = inode->i_private;
ssize_t nwritten = 0; ssize_t nwritten = 0;
ssize_t last; ssize_t last;
int nxtwrndx; int nxtwrndx;
int sval; int sval;
DEBUGASSERT(dev); DEBUGASSERT(dev);
pipe_dumpbuffer("To PIPE:", (FAR uint8_t *)buffer, len); pipe_dumpbuffer("To PIPE:", (FAR uint8_t *)buffer, len);
@@ -559,7 +561,8 @@ ssize_t pipecommon_write(FAR struct file *filep, FAR const char *buffer, size_t
/* Is the write complete? */ /* Is the write complete? */
if (++nwritten >= len) nwritten++;
if ((size_t)nwritten >= len)
{ {
/* Yes.. Notify all of the waiting readers that more data is available */ /* Yes.. Notify all of the waiting readers that more data is available */
@@ -717,7 +720,7 @@ int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds,
{ {
/* This is a request to tear down the poll. */ /* This is a request to tear down the poll. */
struct pollfd **slot = (struct pollfd **)fds->priv; FAR struct pollfd **slot = (FAR struct pollfd **)fds->priv;
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
if (!slot) if (!slot)
@@ -745,9 +748,9 @@ errout:
int pipecommon_ioctl(FAR struct file *filep, int cmd, unsigned long arg) int pipecommon_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{ {
FAR struct inode *inode = filep->f_inode; FAR struct inode *inode = filep->f_inode;
struct pipe_dev_s *dev = inode->i_private; FAR struct pipe_dev_s *dev = inode->i_private;
int ret = -EINVAL; int ret = -EINVAL;
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
/* Some sanity checking */ /* Some sanity checking */
@@ -792,7 +795,7 @@ int pipecommon_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
count = dev->d_wrndx - dev->d_rdndx; count = dev->d_wrndx - dev->d_rdndx;
} }
*(int *)arg = count; *(FAR int *)arg = count;
ret = 0; ret = 0;
} }
break; break;
@@ -812,7 +815,7 @@ int pipecommon_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
count = ((CONFIG_DEV_PIPE_SIZE - dev->d_wrndx) + dev->d_rdndx) - 1; count = ((CONFIG_DEV_PIPE_SIZE - dev->d_wrndx) + dev->d_rdndx) - 1;
} }
*(int *)arg = count; *(FAR int *)arg = count;
ret = 0; ret = 0;
} }
break; break;
+7 -4
View File
@@ -70,14 +70,17 @@ static int lowconsole_ioctl(struct file *filep, int cmd, unsigned long arg);
static const struct file_operations g_consoleops = static const struct file_operations g_consoleops =
{ {
0, /* open */ NULL, /* open */
0, /* close */ NULL, /* close */
lowconsole_read, /* read */ lowconsole_read, /* read */
lowconsole_write, /* write */ lowconsole_write, /* write */
0, /* seek */ NULL, /* seek */
lowconsole_ioctl /* ioctl */ lowconsole_ioctl /* ioctl */
#ifndef CONFIG_DISABLE_POLL #ifndef CONFIG_DISABLE_POLL
, 0 /* poll */ , NULL /* poll */
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif #endif
}; };
+5 -2
View File
@@ -103,6 +103,9 @@ static const struct file_operations g_serialops =
#ifndef CONFIG_DISABLE_POLL #ifndef CONFIG_DISABLE_POLL
, uart_poll /* poll */ , uart_poll /* poll */
#endif #endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif
}; };
/************************************************************************************ /************************************************************************************
@@ -487,7 +490,7 @@ static ssize_t uart_write(FAR struct file *filep, FAR const char *buffer,
* interrupted transfer. * interrupted transfer.
*/ */
if (buflen < nwritten) if (buflen < (size_t)nwritten)
{ {
/* Some data was transferred. Return the number of bytes that /* Some data was transferred. Return the number of bytes that
* were successfully transferred. * were successfully transferred.
@@ -557,7 +560,7 @@ static ssize_t uart_read(FAR struct file *filep, FAR char *buffer, size_t buflen
* data from the end of the buffer. * data from the end of the buffer.
*/ */
while (recvd < buflen) while ((size_t)recvd < buflen)
{ {
#ifdef CONFIG_SERIAL_REMOVABLE #ifdef CONFIG_SERIAL_REMOVABLE
/* If the removable device is no longer connected, refuse to read any /* If the removable device is no longer connected, refuse to read any
+14 -11
View File
@@ -123,14 +123,17 @@ static int ramlog_poll(FAR struct file *filep, FAR struct pollfd *fds,
static const struct file_operations g_ramlogfops = static const struct file_operations g_ramlogfops =
{ {
0, /* open */ NULL, /* open */
0, /* close */ NULL, /* close */
ramlog_read, /* read */ ramlog_read, /* read */
ramlog_write, /* write */ ramlog_write, /* write */
0, /* seek */ NULL, /* seek */
0 /* ioctl */ NULL /* ioctl */
#ifndef CONFIG_DISABLE_POLL #ifndef CONFIG_DISABLE_POLL
, ramlog_poll /* poll */ , ramlog_poll /* poll */
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif #endif
}; };
@@ -206,7 +209,7 @@ static void ramlog_pollnotify(FAR struct ramlog_dev_s *priv,
static int ramlog_addchar(FAR struct ramlog_dev_s *priv, char ch) static int ramlog_addchar(FAR struct ramlog_dev_s *priv, char ch)
{ {
irqstate_t flags; irqstate_t flags;
int nexthead; size_t nexthead;
/* Disable interrupts (in case we are NOT called from interrupt handler) */ /* Disable interrupts (in case we are NOT called from interrupt handler) */
@@ -271,7 +274,7 @@ static ssize_t ramlog_read(FAR struct file *filep, FAR char *buffer, size_t len)
/* Loop until something is read */ /* Loop until something is read */
for (nread = 0; nread < len; ) for (nread = 0; (size_t)nread < len; )
{ {
/* Get the next byte from the buffer */ /* Get the next byte from the buffer */
@@ -437,7 +440,7 @@ static ssize_t ramlog_write(FAR struct file *filep, FAR const char *buffer, size
* interrupts. * interrupts.
*/ */
for (nwritten = 0; nwritten < len; nwritten++) for (nwritten = 0; (size_t)nwritten < len; nwritten++)
{ {
/* Get the next character to output */ /* Get the next character to output */
@@ -529,7 +532,7 @@ int ramlog_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
FAR struct inode *inode = filep->f_inode; FAR struct inode *inode = filep->f_inode;
FAR struct ramlog_dev_s *priv; FAR struct ramlog_dev_s *priv;
pollevent_t eventset; pollevent_t eventset;
int ndx; size_t ndx;
int ret; int ret;
int i; int i;
+5 -2
View File
@@ -114,10 +114,13 @@ static const struct file_operations g_timerops =
timer_close, /* close */ timer_close, /* close */
timer_read, /* read */ timer_read, /* read */
timer_write, /* write */ timer_write, /* write */
0, /* seek */ NULL, /* seek */
timer_ioctl /* ioctl */ timer_ioctl /* ioctl */
#ifndef CONFIG_DISABLE_POLL #ifndef CONFIG_DISABLE_POLL
, 0 /* poll */ , NULL /* poll */
#endif
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, NULL /* unlink */
#endif #endif
}; };
+1 -1
View File
@@ -73,7 +73,7 @@ FAR char *strcasestr(FAR const char *str, FAR const char *substr)
{ {
FAR const char *candidate; /* Candidate in str with matching start character */ FAR const char *candidate; /* Candidate in str with matching start character */
char ch; /* First character of the substring */ char ch; /* First character of the substring */
int len; /* The length of the substring */ size_t len; /* The length of the substring */
/* Special case the empty substring */ /* Special case the empty substring */
+1 -1
View File
@@ -49,7 +49,7 @@ FAR char *strstr(FAR const char *str, FAR const char *substr)
{ {
FAR const char *candidate; /* Candidate in str with matching start character */ FAR const char *candidate; /* Candidate in str with matching start character */
char ch; /* First character of the substring */ char ch; /* First character of the substring */
int len; /* The length of the substring */ size_t len; /* The length of the substring */
/* Special case the empty substring */ /* Special case the empty substring */
+2 -2
View File
@@ -74,9 +74,9 @@ void mm_extend(FAR struct mm_heap_s *heap, FAR void *mem, size_t size,
DEBUGASSERT(heap && mem); DEBUGASSERT(heap && mem);
#if CONFIG_MM_REGIONS > 1 #if CONFIG_MM_REGIONS > 1
DEBUGASSERT(size >= MIN_EXTEND && (unsigned)region < heap->mm_nregions); DEBUGASSERT(size >= MIN_EXTEND && (size_t)region < (size_t)heap->mm_nregions);
#else #else
DEBUGASSERT(size >= MIN_EXTEND && (unsigned)region == 0); DEBUGASSERT(size >= MIN_EXTEND && region == 0);
#endif #endif
/* Make sure that the memory region are properly aligned */ /* Make sure that the memory region are properly aligned */