You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/01/31 13:03:04 UTC

(nuttx) 02/02: compiler/tasking: fix compiler warning on tasking

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 5424ace1cf1aca663fb1e9f17b42ddc2e532d1a6
Author: chao an <an...@lixiang.com>
AuthorDate: Wed Jan 31 09:54:35 2024 +0800

    compiler/tasking: fix compiler warning on tasking
    
    ctc W549: ["serial/serial.c" 877/37] condition is always true
    ctc W549: ["inode/fs_inodesearch.c" 72/8] condition is always true
    ctc W545: ["obstack/lib_obstack_malloc.c" 69/1] missing 'return'
    ctc W545: ["obstack/lib_obstack_malloc.c" 82/1] missing 'return'
    
    Signed-off-by: chao an <an...@lixiang.com>
---
 drivers/serial/serial.c                | 6 ++----
 fs/inode/fs_inodesearch.c              | 5 -----
 libs/libc/obstack/lib_obstack_malloc.c | 2 ++
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index ffce0f9bee..ee7fc7e253 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -874,10 +874,8 @@ static ssize_t uart_read(FAR struct file *filep,
                 {
                   /* Skipping character count down */
 
-                  if (dev->escape-- > 0)
-                    {
-                      continue;
-                    }
+                  dev->escape--;
+                  continue;
                 }
 
               /* Echo if the character is not a control byte */
diff --git a/fs/inode/fs_inodesearch.c b/fs/inode/fs_inodesearch.c
index 79f2125ff5..0ae596b14d 100644
--- a/fs/inode/fs_inodesearch.c
+++ b/fs/inode/fs_inodesearch.c
@@ -69,11 +69,6 @@ static int _inode_compare(FAR const char *fname, FAR struct inode *node)
 {
   FAR char *nname = node->i_name;
 
-  if (!nname)
-    {
-      return 1;
-    }
-
   if (!fname)
     {
       return -1;
diff --git a/libs/libc/obstack/lib_obstack_malloc.c b/libs/libc/obstack/lib_obstack_malloc.c
index 71c2a76e52..8382ad5dc5 100644
--- a/libs/libc/obstack/lib_obstack_malloc.c
+++ b/libs/libc/obstack/lib_obstack_malloc.c
@@ -66,6 +66,7 @@ FAR void *lib_obstack_malloc(size_t size)
 
   obstack_alloc_failed_handler();
   PANIC();
+  return NULL;
 }
 
 FAR void *lib_obstack_realloc(FAR void *ptr, size_t size)
@@ -79,4 +80,5 @@ FAR void *lib_obstack_realloc(FAR void *ptr, size_t size)
 
   obstack_alloc_failed_handler();
   PANIC();
+  return NULL;
 }