summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorBenoît Thébaudeau <benoit@wsystem.com>2015-09-28 15:45:29 +0200
committerTom Rini <trini@konsulko.com>2015-10-11 17:12:07 -0400
commit1d7f2ece69c9d80264321bc4ee07f57eec392538 (patch)
treeee9f7a5b86d972a20dd38df4666cab4af9cc2026 /fs
parent8133f43d1cd4f0df0a6b4c2aa99a47753fda20d6 (diff)
downloadu-boot-imx-1d7f2ece69c9d80264321bc4ee07f57eec392538.zip
u-boot-imx-1d7f2ece69c9d80264321bc4ee07f57eec392538.tar.gz
u-boot-imx-1d7f2ece69c9d80264321bc4ee07f57eec392538.tar.bz2
fs/fat/fat_write: Merge calls to set_cluster()
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/fat/fat_write.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index d0d9df7..e08cf83 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -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;
}