From d2d93ba58cc00064d6e112c5eafca39471349392 Mon Sep 17 00:00:00 2001 From: yinshengkai Date: Wed, 21 Feb 2024 17:45:34 +0800 Subject: [PATCH] fix variable set but not used These variables will trigger variable 'ret' set but not used warnings due to different configurations. Signed-off-by: yinshengkai --- fs/procfs/fs_procfsmeminfo.c | 4 +--- mm/mm_heap/mm_foreach.c | 1 + mm/mm_heap/mm_mallinfo.c | 2 +- mm/mm_heap/mm_memdump.c | 2 +- sched/init/nx_bringup.c | 1 + sched/sched/sched_removeblocked.c | 6 ++---- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/fs/procfs/fs_procfsmeminfo.c b/fs/procfs/fs_procfsmeminfo.c index 852e4a60b20..f07a0ece67e 100644 --- a/fs/procfs/fs_procfsmeminfo.c +++ b/fs/procfs/fs_procfsmeminfo.c @@ -454,7 +454,6 @@ static ssize_t memdump_write(FAR struct file *filep, FAR const char *buffer, size_t buflen) { FAR struct procfs_meminfo_entry_s *entry; - FAR struct meminfo_file_s *procfile; struct mm_memdump_s dump = { PID_MM_ALLOC, @@ -475,8 +474,7 @@ static ssize_t memdump_write(FAR struct file *filep, FAR const char *buffer, /* Recover our private data from the struct file instance */ - procfile = filep->f_priv; - DEBUGASSERT(procfile); + DEBUGASSERT(filep->f_priv); #if CONFIG_MM_BACKTRACE > 0 if (strcmp(buffer, "on") == 0) diff --git a/mm/mm_heap/mm_foreach.c b/mm/mm_heap/mm_foreach.c index 04c886a8e4b..3ee8dda02f1 100644 --- a/mm/mm_heap/mm_foreach.c +++ b/mm/mm_heap/mm_foreach.c @@ -55,6 +55,7 @@ void mm_foreach(FAR struct mm_heap_s *heap, mm_node_handler_t handler, # define region 0 #endif + UNUSED(prev); DEBUGASSERT(handler); /* Visit each region */ diff --git a/mm/mm_heap/mm_mallinfo.c b/mm/mm_heap/mm_mallinfo.c index 090dc936362..f1ca89edbc4 100644 --- a/mm/mm_heap/mm_mallinfo.c +++ b/mm/mm_heap/mm_mallinfo.c @@ -65,7 +65,7 @@ static void mallinfo_handler(FAR struct mm_allocnode_s *node, FAR void *arg) else { FAR struct mm_freenode_s *fnode = (FAR void *)node; - + UNUSED(fnode); DEBUGASSERT(nodesize >= MM_MIN_CHUNK); DEBUGASSERT(fnode->blink->flink == fnode); DEBUGASSERT(MM_SIZEOF_NODE(fnode->blink) <= nodesize); diff --git a/mm/mm_heap/mm_memdump.c b/mm/mm_heap/mm_memdump.c index 510a1785746..6b05f17f773 100644 --- a/mm/mm_heap/mm_memdump.c +++ b/mm/mm_heap/mm_memdump.c @@ -104,7 +104,7 @@ static void memdump_handler(FAR struct mm_allocnode_s *node, FAR void *arg) else if (dump->pid == PID_MM_FREE) { FAR struct mm_freenode_s *fnode = (FAR void *)node; - + UNUSED(fnode); DEBUGASSERT(nodesize >= MM_MIN_CHUNK); DEBUGASSERT(fnode->blink->flink == fnode); DEBUGASSERT(MM_SIZEOF_NODE(fnode->blink) <= nodesize); diff --git a/sched/init/nx_bringup.c b/sched/init/nx_bringup.c index b9922eb3b66..f812d824719 100644 --- a/sched/init/nx_bringup.c +++ b/sched/init/nx_bringup.c @@ -307,6 +307,7 @@ static inline void nx_start_application(void) posix_spawnattr_t attr; #endif int ret; + UNUSED(ret); #ifdef CONFIG_ETC_ROMFS nx_romfsetc(); diff --git a/sched/sched/sched_removeblocked.c b/sched/sched/sched_removeblocked.c index 74c597c36fe..292180bf033 100644 --- a/sched/sched/sched_removeblocked.c +++ b/sched/sched/sched_removeblocked.c @@ -55,12 +55,10 @@ void nxsched_remove_blocked(FAR struct tcb_s *btcb) { - tstate_t task_state = btcb->task_state; - /* Make sure the TCB is in a valid blocked state */ - DEBUGASSERT(task_state >= FIRST_BLOCKED_STATE && - task_state <= LAST_BLOCKED_STATE); + DEBUGASSERT(btcb->task_state >= FIRST_BLOCKED_STATE && + btcb->task_state <= LAST_BLOCKED_STATE); /* Remove the TCB from the blocked task list associated * with this state