[PATCH] cpukit: Remove or use unused variable assignments

Kinsey Moore kinsey.moore at oarcorp.com
Mon Jan 8 20:51:26 UTC 2024


---
 cpukit/libblock/src/media.c          | 2 +-
 cpukit/libfs/src/dosfs/fat.c         | 2 +-
 cpukit/libfs/src/dosfs/msdos_file.c  | 5 +++++
 cpukit/libfs/src/dosfs/msdos_misc.c  | 3 ++-
 cpukit/libfs/src/imfs/imfs_memfile.c | 1 -
 cpukit/posix/src/killinfo.c          | 1 -
 6 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/cpukit/libblock/src/media.c b/cpukit/libblock/src/media.c
index 3ab01602ae..482cdc4fb0 100644
--- a/cpukit/libblock/src/media.c
+++ b/cpukit/libblock/src/media.c
@@ -434,7 +434,7 @@ static rtems_status_code process_event(
 {
   rtems_status_code sc = RTEMS_SUCCESSFUL;
   rtems_status_code sc_retry = RTEMS_SUCCESSFUL;
-  rtems_media_state state = RTEMS_MEDIA_STATE_FAILED;
+  rtems_media_state state;
   char *dest = NULL;
 
   do {
diff --git a/cpukit/libfs/src/dosfs/fat.c b/cpukit/libfs/src/dosfs/fat.c
index 9229406dec..88b4a2859b 100644
--- a/cpukit/libfs/src/dosfs/fat.c
+++ b/cpukit/libfs/src/dosfs/fat.c
@@ -93,7 +93,6 @@ fat_buf_release(fat_fs_info_t *fs_info)
         uint32_t sec_num = fs_info->c.blk_num;
         bool     sec_of_fat = ((sec_num >= fs_info->vol.fat_loc) &&
                               (sec_num < fs_info->vol.rdir_loc));
-        uint32_t blk = fat_sector_num_to_block_num(fs_info, sec_num);
         uint32_t blk_ofs = fat_sector_offset_to_block_offset(fs_info,
                                                              sec_num,
                                                              0);
@@ -115,6 +114,7 @@ fat_buf_release(fat_fs_info_t *fs_info)
             for (i = 1; i < fs_info->vol.fats; i++)
             {
                 rtems_bdbuf_buffer *bd;
+                uint32_t blk;
 
                 sec_num = fs_info->c.blk_num + fs_info->vol.fat_length * i,
                 blk = fat_sector_num_to_block_num(fs_info, sec_num);
diff --git a/cpukit/libfs/src/dosfs/msdos_file.c b/cpukit/libfs/src/dosfs/msdos_file.c
index fd14f5084d..e25f292484 100644
--- a/cpukit/libfs/src/dosfs/msdos_file.c
+++ b/cpukit/libfs/src/dosfs/msdos_file.c
@@ -223,6 +223,11 @@ msdos_file_sync(rtems_libio_t *iop)
     }
 
     rc = fat_sync(&fs_info->fat);
+    if (rc != RC_OK)
+    {
+        msdos_fs_unlock(fs_info);
+        return rc;
+    }
 
     msdos_fs_unlock(fs_info);
 
diff --git a/cpukit/libfs/src/dosfs/msdos_misc.c b/cpukit/libfs/src/dosfs/msdos_misc.c
index 8bde792ae5..c40988b98f 100644
--- a/cpukit/libfs/src/dosfs/msdos_misc.c
+++ b/cpukit/libfs/src/dosfs/msdos_misc.c
@@ -288,7 +288,6 @@ msdos_long_to_short(rtems_dosfs_convert_control     *converter,
         &codepage_name_len);
     if (eno == EINVAL)
     {
-        eno = 0;
         type = MSDOS_NAME_LONG;
     }
     else
@@ -1747,6 +1746,8 @@ msdos_add_file (
     /* Get position of short file name entry */
     ret = msdos_get_pos(fs_info, fat_fd, bts2rd, short_file_offset,
                         &dir_pos->sname);
+    if (ret != RC_OK)
+        return ret;
 
     /*
      * Handle the entry writes.
diff --git a/cpukit/libfs/src/imfs/imfs_memfile.c b/cpukit/libfs/src/imfs/imfs_memfile.c
index 66c67c6ba0..3930fd6ae5 100644
--- a/cpukit/libfs/src/imfs/imfs_memfile.c
+++ b/cpukit/libfs/src/imfs/imfs_memfile.c
@@ -638,7 +638,6 @@ ssize_t IMFS_memfile_write(
     fprintf(stdout, "write %d in %d: %*s\n", to_copy, block, to_copy, src );
     #endif
     memcpy( &(*block_ptr)[ 0 ], src, my_length );
-    my_length = 0;
     copied += to_copy;
   }
 
diff --git a/cpukit/posix/src/killinfo.c b/cpukit/posix/src/killinfo.c
index f56c5b3174..bde511504a 100644
--- a/cpukit/posix/src/killinfo.c
+++ b/cpukit/posix/src/killinfo.c
@@ -323,7 +323,6 @@ int _POSIX_signals_Send(
    *    + sigprocmask() unblocks the signal, OR
    *    + sigaction() which changes the handler to SIG_IGN.
    */
-  the_thread = NULL;
   goto post_process_signal;
 
   /*
-- 
2.39.2



More information about the devel mailing list