FAT: Simplify get_contents
One call to get_cluster can be factorized with another, so avoid
duplicating code.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index fa977b3..f7bb1da 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -367,21 +367,9 @@
actsize += bytesperclust;
}
- /* actsize >= file size */
- actsize -= bytesperclust;
-
- /* get remaining clusters */
- if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
- printf("Error reading cluster\n");
- return -1;
- }
-
/* get remaining bytes */
- gotsize += (int)actsize;
- filesize -= actsize;
- buffer += actsize;
actsize = filesize;
- if (get_cluster(mydata, endclust, buffer, (int)actsize) != 0) {
+ if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) {
printf("Error reading cluster\n");
return -1;
}