summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoît Thébaudeau <benoit.thebaudeau@advansee.com>2012-07-20 15:21:37 +0200
committerWolfgang Denk <wd@denx.de>2012-09-02 17:22:43 +0200
commit0880e5bb0c638aec47c1f9349bbb9a0f48179313 (patch)
tree9c6f97e251d02420179ef90226c7c23bb958e604
parentcc63b25efb908afa3c1405cd6fce1dd5659f91d7 (diff)
downloadu-boot-imx-0880e5bb0c638aec47c1f9349bbb9a0f48179313.zip
u-boot-imx-0880e5bb0c638aec47c1f9349bbb9a0f48179313.tar.gz
u-boot-imx-0880e5bb0c638aec47c1f9349bbb9a0f48179313.tar.bz2
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>
-rw-r--r--fs/fat/fat.c14
1 files changed, 1 insertions, 13 deletions
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 @@ get_contents(fsdata *mydata, dir_entry *dentptr, __u8 *buffer,
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;
}