Merged in paulpatience/nuttx (pull request #26)
Fix issues detected by clang
This commit is contained in:
commit
5055c7a99d
|
@ -132,7 +132,6 @@ ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset, size_t le
|
|||
|
||||
/* Adjust pointers and counts */
|
||||
|
||||
sectoffset = 0;
|
||||
sector++;
|
||||
|
||||
if (sector >= bch->nsectors)
|
||||
|
@ -167,7 +166,6 @@ ssize_t bchlib_read(FAR void *handle, FAR char *buffer, size_t offset, size_t le
|
|||
|
||||
/* Adjust pointers and counts */
|
||||
|
||||
sectoffset = 0;
|
||||
sector += nsectors;
|
||||
|
||||
nbytes = nsectors * bch->sectsize;
|
||||
|
|
|
@ -132,7 +132,6 @@ ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset, si
|
|||
|
||||
/* Adjust pointers and counts */
|
||||
|
||||
sectoffset = 0;
|
||||
sector++;
|
||||
|
||||
if (sector >= bch->nsectors)
|
||||
|
@ -169,7 +168,6 @@ ssize_t bchlib_write(FAR void *handle, FAR const char *buffer, size_t offset, si
|
|||
|
||||
/* Adjust pointers and counts */
|
||||
|
||||
sectoffset = 0;
|
||||
sector += nsectors;
|
||||
|
||||
nbytes = nsectors * bch->sectsize;
|
||||
|
|
|
@ -94,7 +94,13 @@ ssize_t lib_fwrite(FAR const void *ptr, size_t count, FAR FILE *stream)
|
|||
|
||||
/* Make sure that writing to this stream is allowed */
|
||||
|
||||
if (!stream || (stream->fs_oflags & O_WROK) == 0)
|
||||
if (stream == NULL)
|
||||
{
|
||||
set_errno(EBADF);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if ((stream->fs_oflags & O_WROK) == 0)
|
||||
{
|
||||
set_errno(EBADF);
|
||||
goto errout;
|
||||
|
|
|
@ -112,7 +112,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
int vasprintf(FAR char **ptr, const char *fmt, va_list ap)
|
||||
int vasprintf(FAR char **ptr, FAR const char *fmt, va_list ap)
|
||||
{
|
||||
struct lib_outstream_s nulloutstream;
|
||||
struct lib_memoutstream_s memoutstream;
|
||||
|
@ -130,12 +130,12 @@ int vasprintf(FAR char **ptr, const char *fmt, va_list ap)
|
|||
va_copy(ap2, ap);
|
||||
#endif
|
||||
|
||||
/* First, use a nullstream to get the size of the buffer. The number
|
||||
/* First, use a nullstream to get the size of the buffer. The number
|
||||
* of bytes returned may or may not include the null terminator.
|
||||
*/
|
||||
|
||||
lib_nulloutstream(&nulloutstream);
|
||||
nbytes = lib_vsprintf((FAR struct lib_outstream_s *)&nulloutstream, fmt, ap1);
|
||||
(void)lib_vsprintf((FAR struct lib_outstream_s *)&nulloutstream, fmt, ap1);
|
||||
|
||||
/* Then allocate a buffer to hold that number of characters, adding one
|
||||
* for the null terminator.
|
||||
|
|
|
@ -258,10 +258,6 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
|
|||
/* Return the previous free node to the nodelist (with the new size) */
|
||||
|
||||
mm_addfreechunk(heap, prev);
|
||||
|
||||
/* Now we want to return newnode */
|
||||
|
||||
oldnode = newnode;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -272,6 +268,8 @@ FAR void *mm_realloc(FAR struct mm_heap_s *heap, FAR void *oldmem,
|
|||
next->preceding = newnode->size | (next->preceding & MM_ALLOC_BIT);
|
||||
}
|
||||
|
||||
/* Now we want to return newnode */
|
||||
|
||||
oldnode = newnode;
|
||||
oldsize = newnode->size;
|
||||
|
||||
|
|
|
@ -179,7 +179,6 @@ int sem_timedwait(FAR sem_t *sem, FAR const struct timespec *abstime)
|
|||
|
||||
/* Start the watchdog */
|
||||
|
||||
errcode = OK;
|
||||
(void)wd_start(rtcb->waitdog, ticks, (wdentry_t)sem_timeout, 1, getpid());
|
||||
|
||||
/* Now perform the blocking wait */
|
||||
|
@ -196,6 +195,11 @@ int sem_timedwait(FAR sem_t *sem, FAR const struct timespec *abstime)
|
|||
|
||||
wd_cancel(rtcb->waitdog);
|
||||
|
||||
if (errcode != OK)
|
||||
{
|
||||
goto errout_with_irqdisabled;
|
||||
}
|
||||
|
||||
/* We can now restore interrupts and delete the watchdog */
|
||||
|
||||
/* Success exits */
|
||||
|
|
Loading…
Reference in New Issue