diff mbox

[U-Boot,6/7] FAT: Simplify get_contents

Message ID 685733824.294131.1342735372755.JavaMail.root@advansee.com
State Accepted
Commit 0880e5bb0c638aec47c1f9349bbb9a0f48179313
Headers show

Commit Message

Benoît Thébaudeau July 19, 2012, 10:02 p.m. UTC
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>
---
 .../fs/fat/fat.c                                   |   14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
diff mbox

Patch

diff --git u-boot-66714b1.orig/fs/fat/fat.c u-boot-66714b1/fs/fat/fat.c
index 4c80820..8ac8b85 100644
--- u-boot-66714b1.orig/fs/fat/fat.c
+++ u-boot-66714b1/fs/fat/fat.c
@@ -368,21 +368,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;
 		}