]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
fs/fat/fat_write: Merge calls to set_cluster()
authorBenoît Thébaudeau <benoit@wsystem.com>
Mon, 28 Sep 2015 13:45:29 +0000 (15:45 +0200)
committerTom Rini <trini@konsulko.com>
Sun, 11 Oct 2015 21:12:07 +0000 (17:12 -0400)
set_contents() had uselessly split calls to set_cluster(). Merge these
calls, which removes some cases of set_cluster() being called with a
size of zero.

Signed-off-by: Benoît Thébaudeau <benoit@wsystem.com>
fs/fat/fat_write.c

index d0d9df717093ed95e4a4994d15455781c712278e..e08cf83b05352ef5dc1cf57033815cdfdbc1c0d1 100644 (file)
@@ -728,21 +728,10 @@ set_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
                        endclust = newclust;
                        actsize += bytesperclust;
                }
-               /* actsize >= file size */
-               actsize -= bytesperclust;
-               /* set remaining clusters */
-               if (set_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
-                       debug("error: writing cluster\n");
-                       return -1;
-               }
 
                /* set remaining bytes */
-               *gotsize += actsize;
-               filesize -= actsize;
-               buffer += actsize;
                actsize = filesize;
-
-               if (set_cluster(mydata, endclust, buffer, (int)actsize) != 0) {
+               if (set_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
                        debug("error: writing cluster\n");
                        return -1;
                }