Merge tag 'u-boot-atmel-fixes-2021.01-b' of https://gitlab.denx.de/u-boot/custodians...
[platform/kernel/u-boot.git] / fs / fat / fat.c
index 425d877..fb6ba89 100644 (file)
@@ -14,6 +14,7 @@
 #include <exports.h>
 #include <fat.h>
 #include <fs.h>
+#include <log.h>
 #include <asm/byteorder.h>
 #include <part.h>
 #include <malloc.h>
@@ -277,7 +278,10 @@ get_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer, unsigned long size)
                }
        } else {
                idx = size / mydata->sect_size;
-               ret = disk_read(startsect, idx, buffer);
+               if (idx == 0)
+                       ret = 0;
+               else
+                       ret = disk_read(startsect, idx, buffer);
                if (ret != idx) {
                        debug("Error reading data (got %d)\n", ret);
                        return -1;
@@ -922,8 +926,7 @@ static int fat_itr_next(fat_itr *itr)
                if (!dent)
                        return 0;
 
-               if (dent->name[0] == DELETED_FLAG ||
-                   dent->name[0] == aRING)
+               if (dent->name[0] == DELETED_FLAG)
                        continue;
 
                if (dent->attr & ATTR_VOLUME) {
@@ -948,9 +951,7 @@ static int fat_itr_next(fat_itr *itr)
                                /* Volume label or VFAT entry, skip */
                                continue;
                        }
-               } else if (!(dent->attr & ATTR_ARCH) &&
-                          !(dent->attr & ATTR_DIR))
-                       continue;
+               }
 
                /* short file name */
                break;