]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - fs/fat/fat.c
Merge branch 'warning-cleanup'
[karo-tx-uboot.git] / fs / fat / fat.c
index 28c7805d0d50d030b7c2dfe10617ea1cb69e22b9..2445f1e784d322ec70ff7412db1c60615ada4cc3 100644 (file)
@@ -84,6 +84,7 @@ fat_register_device(block_dev_desc_t *dev_desc, int part_no)
                return -1;
        }
 #if (defined(CONFIG_CMD_IDE) || \
+     defined(CONFIG_CMD_MG_DISK) || \
      defined(CONFIG_CMD_SATA) || \
      defined(CONFIG_CMD_SCSI) || \
      defined(CONFIG_CMD_USB) || \
@@ -139,28 +140,6 @@ dirdelim(char *str)
        return -1;
 }
 
-
-/*
- * Match volume_info fs_type strings.
- * Return 0 on match, -1 otherwise.
- */
-static int
-compare_sign(char *str1, char *str2)
-{
-       char *end = str1+SIGNLEN;
-
-       while (str1 != end) {
-               if (*str1 != *str2) {
-                       return -1;
-               }
-               str1++;
-               str2++;
-       }
-
-       return 0;
-}
-
-
 /*
  * Extract zero terminated short name from a directory entry.
  */
@@ -704,20 +683,16 @@ read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
        }
        memcpy(volinfo, vistart, sizeof(volume_info));
 
-       /* Terminate fs_type string. Writing past the end of vistart
-          is ok - it's just the buffer. */
-       vistart->fs_type[8] = '\0';
-
        if (*fatsize == 32) {
-               if (compare_sign(FAT32_SIGN, vistart->fs_type) == 0) {
+               if (strncmp(FAT32_SIGN, vistart->fs_type, SIGNLEN) == 0) {
                        return 0;
                }
        } else {
-               if (compare_sign(FAT12_SIGN, vistart->fs_type) == 0) {
+               if (strncmp(FAT12_SIGN, vistart->fs_type, SIGNLEN) == 0) {
                        *fatsize = 12;
                        return 0;
                }
-               if (compare_sign(FAT16_SIGN, vistart->fs_type) == 0) {
+               if (strncmp(FAT16_SIGN, vistart->fs_type, SIGNLEN) == 0) {
                        *fatsize = 16;
                        return 0;
                }
@@ -983,6 +958,7 @@ file_fat_detectfs(void)
                return 1;
        }
 #if defined(CONFIG_CMD_IDE) || \
+    defined(CONFIG_CMD_MG_DISK) || \
     defined(CONFIG_CMD_SATA) || \
     defined(CONFIG_CMD_SCSI) || \
     defined(CONFIG_CMD_USB) || \