You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2020/07/30 07:00:01 UTC

[incubator-nuttx] 02/03: fs/romfs/fs_romfs.c: Remove redundant assignments

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

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

commit dc6b61caf922efd94382cd0ac2a1b2e18363e45e
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Thu Jul 30 13:25:21 2020 +0900

    fs/romfs/fs_romfs.c: Remove redundant assignments
    
    Found by clang-check:
    
    romfs/fs_romfs.c:431:7: warning: Value stored to 'bytesread' is never read
          bytesread  = 0;
          ^            ~
    romfs/fs_romfs.c:455:11: warning: Value stored to 'sector' is never read
              sector    += nsectors;
              ^            ~~~~~~~~
    2 warnings generated.
---
 fs/romfs/fs_romfs.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/fs/romfs/fs_romfs.c b/fs/romfs/fs_romfs.c
index a2c49a5..1676aa3 100644
--- a/fs/romfs/fs_romfs.c
+++ b/fs/romfs/fs_romfs.c
@@ -428,7 +428,6 @@ static ssize_t romfs_read(FAR struct file *filep, FAR char *buffer,
       offset     = rf->rf_startoffset + filep->f_pos;
       sector     = SEC_NSECTORS(rm, offset);
       sectorndx  = offset & SEC_NDXMASK(rm);
-      bytesread  = 0;
 
       /* Check if the user has provided a buffer large enough to
        * hold one or more complete sectors -AND- the read is
@@ -452,7 +451,6 @@ static ssize_t romfs_read(FAR struct file *filep, FAR char *buffer,
               goto errout_with_semaphore;
             }
 
-          sector    += nsectors;
           bytesread  = nsectors * rm->rm_hwsectorsize;
         }
       else
@@ -479,12 +477,6 @@ static ssize_t romfs_read(FAR struct file *filep, FAR char *buffer,
 
               bytesread = buflen;
             }
-          else
-            {
-              /* We will read to the end of the buffer (or beyond) */
-
-             sector++;
-            }
 
           finfo("Return %d bytes from sector offset %d\n",
                 bytesread, sectorndx);