diff --git a/[refs] b/[refs] index 9851b8feda3f..d1be0ce919ff 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 235d6200ea63372935e097cb82e6a8c133d51cad +refs/heads/master: 2362a53ec59f286495307e0e0d8ef2401e8c5c49 diff --git a/trunk/drivers/mtd/ubi/io.c b/trunk/drivers/mtd/ubi/io.c index 7c304eec78b5..db3efdef2433 100644 --- a/trunk/drivers/mtd/ubi/io.c +++ b/trunk/drivers/mtd/ubi/io.c @@ -173,6 +173,16 @@ int ubi_io_read(const struct ubi_device *ubi, void *buf, int pnum, int offset, 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);