summaryrefslogtreecommitdiffstats
path: root/fs/fat/fat.c
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2011-08-19 09:32:34 +0000
committerWolfgang Denk <wd@denx.de>2011-10-01 21:52:06 +0200
commit40e219165bcdf450cc69976fa129f2ef9889973a (patch)
treee4dd214f13a6cfdacc2dec8f0e93d15a170737c2 /fs/fat/fat.c
parent60b36f0fc7c77e98b9d55c237e455c42a1caa44b (diff)
downloadblackbird-obmc-uboot-40e219165bcdf450cc69976fa129f2ef9889973a.tar.gz
blackbird-obmc-uboot-40e219165bcdf450cc69976fa129f2ef9889973a.zip
fat: root directory cluster only makes sense for FAT32
The root directory cluster field only exists in a FAT32 boot sector, so the 'root_cluster' variable in do_fat_read() contains garbage in case of FAT12/16. Make it contain 0 instead as this is what is passed to get_vfatname() in that case anyway. Signed-off-by: Sergei Shtylyov <sshtylyov@mvista.com>
Diffstat (limited to 'fs/fat/fat.c')
-rw-r--r--fs/fat/fat.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index d5aded420d..aa0be18b8f 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -788,7 +788,7 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
int files = 0, dirs = 0;
long ret = -1;
int firsttime;
- __u32 root_cluster;
+ __u32 root_cluster = 0;
int rootdir_size = 0;
int j;
@@ -797,12 +797,12 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
return -1;
}
- root_cluster = bs.root_cluster;
-
- if (mydata->fatsize == 32)
+ if (mydata->fatsize == 32) {
+ root_cluster = bs.root_cluster;
mydata->fatlength = bs.fat32_length;
- else
+ } else {
mydata->fatlength = bs.fat_length;
+ }
mydata->fat_sect = bs.reserved;
@@ -904,9 +904,7 @@ do_fat_read (const char *filename, void *buffer, unsigned long maxsize,
((dir_slot *)dentptr)->alias_checksum;
get_vfatname(mydata,
- (mydata->fatsize == 32) ?
- root_cluster :
- 0,
+ root_cluster,
do_fat_read_block,
dentptr, l_name);
OpenPOWER on IntegriCloud