]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/karo/common/mmc.c
fs/fs.c: correctly interpret the '(max)len' parameter to fs_read()
[karo-tx-uboot.git] / board / karo / common / mmc.c
index be42decbf46ff46c3455fd1a28f2284aac1ab1f5..6143e1575649dac9f7af379a836ed0ea4c4340e8 100644 (file)
@@ -163,12 +163,17 @@ int karo_load_mmc_part(const char *part, void *addr, size_t len)
                debug("Read %u (%u) byte from partition '%s' @ offset 0x"LBAF"\n",
                        ret * mmc->read_bl_len, len, part, part_info.start);
        } else if (partnum == 0) {
-               int len_read;
-
-               printf("Reading file %s from mmc partition %d\n", part, 0);
-               len_read = fs_read(part, (ulong)addr, 0, 0);
-               if (len_read < 0)
-                       printf("Read from %s failed: %d\n", part, len_read);
+               loff_t len_read;
+
+               debug("Trying to read (%u) byte from file '%s' in mmc partition %d\n",
+                       len, part, partnum);
+               ret = fs_read(part, (ulong)addr, 0, len, &len_read);
+               if (ret < 0) {
+                       printf("Failed to read %u byte from %s in mmc partition %d; err: %d\n",
+                               len, part, partnum, ret);
+                       goto out;
+               }
+               debug("Read %llu bytes from %s\n", len_read, part);
        } else {
                ret = partnum;
                goto out;