summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2016-06-28 13:51:07 +0200
committerRichard Weinberger <richard@nod.at>2016-07-29 23:29:44 +0200
commit8a8e8d2fdbab047712fc5c3ac2704dc629af511d (patch)
tree273f16d83dc585d918b4df7f6713f113e789bfc5 /drivers/mtd/ubi
parentubifs: Make xattr structures static (diff)
downloadlinux-8a8e8d2fdbab047712fc5c3ac2704dc629af511d.tar.xz
linux-8a8e8d2fdbab047712fc5c3ac2704dc629af511d.zip
ubi: Only read necessary size when reading the VID header
When reading the vid hdr from the device UBI always reads a whole page. Instead, read only the data we actually need and speed up attachment of UBI devices by potentially making use of reading subpages if the NAND driver supports it. Since the VID header may be at offset vid_hdr_shift in the page and we can only read from the beginning of a page we have to add that offset to the read size. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd/ubi')
-rw-r--r--drivers/mtd/ubi/io.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 10cf3b549959..ff8cafe1e5cd 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -1019,7 +1019,7 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum,
p = (char *)vid_hdr - ubi->vid_hdr_shift;
read_err = ubi_io_read(ubi, p, pnum, ubi->vid_hdr_aloffset,
- ubi->vid_hdr_alsize);
+ ubi->vid_hdr_shift + UBI_VID_HDR_SIZE);
if (read_err && read_err != UBI_IO_BITFLIPS && !mtd_is_eccerr(read_err))
return read_err;