Commit 0880e5bb0c638aec47c1f9349bbb9a0f48179313
Committed by
Wolfgang Denk
1 parent
cc63b25efb
Exists in
master
and in
54 other branches
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>
Showing 1 changed file with 1 additions and 13 deletions Side-by-side Diff
fs/fat/fat.c
... | ... | @@ -367,21 +367,9 @@ |
367 | 367 | actsize += bytesperclust; |
368 | 368 | } |
369 | 369 | |
370 | - /* actsize >= file size */ | |
371 | - actsize -= bytesperclust; | |
372 | - | |
373 | - /* get remaining clusters */ | |
374 | - if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) { | |
375 | - printf("Error reading cluster\n"); | |
376 | - return -1; | |
377 | - } | |
378 | - | |
379 | 370 | /* get remaining bytes */ |
380 | - gotsize += (int)actsize; | |
381 | - filesize -= actsize; | |
382 | - buffer += actsize; | |
383 | 371 | actsize = filesize; |
384 | - if (get_cluster(mydata, endclust, buffer, (int)actsize) != 0) { | |
372 | + if (get_cluster(mydata, curclust, buffer, (int)actsize) != 0) { | |
385 | 373 | printf("Error reading cluster\n"); |
386 | 374 | return -1; |
387 | 375 | } |