]> 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 b452a0b1e8123fcd02a303c5a16740cdcad48f62..6143e1575649dac9f7af379a836ed0ea4c4340e8 100644 (file)
@@ -42,6 +42,7 @@ static int find_partitions(const char *ifname, int devno, int fstype,
        int p;
        int part;
        block_dev_desc_t *dd;
+       char dev_part_str[16];
 
        dd = get_dev(ifname, devno);
        if (!dd || dd->type == DEV_TYPE_UNKNOWN) {
@@ -78,7 +79,8 @@ static int find_partitions(const char *ifname, int devno, int fstype,
                ret = -1;
                goto cleanup;
        }
-
+       snprintf(dev_part_str, sizeof(dev_part_str), "%d:%d", devno, part);
+       fs_set_blk_dev(ifname, dev_part_str, fstype);
        ret = part;
        *dev_desc = dd;
 
@@ -163,17 +165,15 @@ int karo_load_mmc_part(const char *part, void *addr, size_t len)
        } else if (partnum == 0) {
                loff_t len_read;
 
-               debug("Reading file %s from mmc partition %d\n", part,
-                       partnum);
+               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 mmc partition %d\n",
-                               len, partnum);
+                       printf("Failed to read %u byte from %s in mmc partition %d; err: %d\n",
+                               len, part, partnum, ret);
                        goto out;
                }
-               if (len_read < len) {
-                       printf("Read only %llu of %u bytes\n", (u64)len_read, len);
-               }
+               debug("Read %llu bytes from %s\n", len_read, part);
        } else {
                ret = partnum;
                goto out;