]> err.no Git - linux-2.6/blobdiff - drivers/mtd/ubi/io.c
Merge branch 'linus' into x86/amd-iommu
[linux-2.6] / drivers / mtd / ubi / io.c
index 7c304eec78b59ba8142a411a96ab4d925760052f..4ac11df7b048d3a24684744c4f399f13b81653ea 100644 (file)
@@ -173,6 +173,16 @@ retry:
                ubi_err("error %d while reading %d bytes from PEB %d:%d, "
                        "read %zd bytes", err, len, pnum, offset, read);
                ubi_dbg_dump_stack();
+
+               /*
+                * The driver should never return -EBADMSG if it failed to read
+                * all the requested data. But some buggy drivers might do
+                * this, so we change it to -EIO.
+                */
+               if (read != len && err == -EBADMSG) {
+                       ubi_assert(0);
+                       err = -EIO;
+               }
        } else {
                ubi_assert(len == read);
 
@@ -621,6 +631,8 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum,
 
        dbg_io("read EC header from PEB %d", pnum);
        ubi_assert(pnum >= 0 && pnum < ubi->peb_count);
+       if (UBI_IO_DEBUG)
+               verbose = 1;
 
        err = ubi_io_read(ubi, ec_hdr, pnum, 0, UBI_EC_HDR_SIZE);
        if (err) {
@@ -894,6 +906,8 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum,
 
        dbg_io("read VID header from PEB %d", pnum);
        ubi_assert(pnum >= 0 &&  pnum < ubi->peb_count);
+       if (UBI_IO_DEBUG)
+               verbose = 1;
 
        p = (char *)vid_hdr - ubi->vid_hdr_shift;
        err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset,