]> git.sur5r.net Git - u-boot/blobdiff - fs/fat/fat.c
Kconfig: Add a CONFIG_IDE option
[u-boot] / fs / fat / fat.c
index fe899d0442d614fa93dd49a0a7cefc4f7ecdbb41..a71bad1cbcf75ce44ba28968293929dca70479cb 100644 (file)
@@ -110,7 +110,7 @@ int fat_register_device(struct blk_desc *dev_desc, int part_no)
                info.name[0] = 0;
                info.type[0] = 0;
                info.bootable = 0;
-#ifdef CONFIG_PARTITION_UUIDS
+#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
                info.uuid[0] = 0;
 #endif
        }
@@ -179,7 +179,7 @@ int flush_dirty_fat_buffer(fsdata *mydata)
 static __u32 get_fatent(fsdata *mydata, __u32 entry)
 {
        __u32 bufnum;
-       __u32 off16, offset;
+       __u32 offset, off8;
        __u32 ret = 0x00;
 
        if (CHECK_CLUST(entry, mydata->fatsize)) {
@@ -242,8 +242,9 @@ static __u32 get_fatent(fsdata *mydata, __u32 entry)
                ret = FAT2CPU16(((__u16 *) mydata->fatbuf)[offset]);
                break;
        case 12:
-               off16 = (offset * 3) / 2;
-               ret = FAT2CPU16(*(__u16 *)(mydata->fatbuf + off16));
+               off8 = (offset * 3) / 2;
+               /* fatbut + off8 may be unaligned, read in byte granularity */
+               ret = mydata->fatbuf[off8] + (mydata->fatbuf[off8 + 1] << 8);
 
                if (offset & 0x1)
                        ret >>= 4;
@@ -1249,7 +1250,7 @@ int file_fat_detectfs(void)
                return 1;
        }
 
-#if defined(CONFIG_CMD_IDE) || \
+#if defined(CONFIG_IDE) || \
     defined(CONFIG_CMD_SATA) || \
     defined(CONFIG_SCSI) || \
     defined(CONFIG_CMD_USB) || \